<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Tricky way to get index of row in query rule</title><link>https://community.appian.com/discussions/f/data/18734/tricky-way-to-get-index-of-row-in-query-rule</link><description>Dear all, 
 I am trying to get data from the DB to show milestone and trying to figure out how to build a query rule to return the index of the last non-null value a list of rows . See the attached picture. How can I code this query rule to return the</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Tricky way to get index of row in query rule</title><link>https://community.appian.com/thread/73739?ContentTypeID=1</link><pubDate>Fri, 01 May 2020 16:10:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:65c1ada5-05ca-4ab4-b74a-2d639c00173a</guid><dc:creator>nanfak</dc:creator><description>&lt;p&gt;Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Tricky way to get index of row in query rule</title><link>https://community.appian.com/thread/73738?ContentTypeID=1</link><pubDate>Fri, 01 May 2020 15:11:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:30f455ba-b1b9-4e64-9cd1-3fb652018a8a</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;(edited to make up for my mistake - you should select the MAX(Index) where the column(s) are NOT null!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Tricky way to get index of row in query rule</title><link>https://community.appian.com/thread/73737?ContentTypeID=1</link><pubDate>Fri, 01 May 2020 15:09:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f68224cd-4f1a-43b5-98bd-396488397232</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;It;&amp;#39;s pretty straightforward. Create a new CDT, select the option to create from a database object, pick the Datastore that points to your DB, then pick the VIEW. You&amp;#39;ll then get a dialogue to set the attributes of the CDT. Things to remember:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;make sure you set the namespace to the standard one for your application&lt;/li&gt;
&lt;li&gt;make sure you set one column as the Primary Key - in your case this will be the PK selected in your VIEW, so make sure you&amp;#39;ve included it!&lt;/li&gt;
&lt;li&gt;rename the attributes according to the standards for you application&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;...here&amp;#39;s the official documentation:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.appian.com/suite/help/20.1/Mapping_CDTs_to_Pre-defined_Database_Tables.html"&gt;https://docs.appian.com/suite/help/20.1/Mapping_CDTs_to_Pre-defined_Database_Tables.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Tricky way to get index of row in query rule</title><link>https://community.appian.com/thread/73736?ContentTypeID=1</link><pubDate>Fri, 01 May 2020 15:04:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0970b027-fca4-4e5b-9457-8f7a020cdcfa</guid><dc:creator>nanfak</dc:creator><description>&lt;p&gt;Thanks, is there a quick guide to creating a CDT from views?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Tricky way to get index of row in query rule</title><link>https://community.appian.com/thread/73735?ContentTypeID=1</link><pubDate>Fri, 01 May 2020 15:01:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c08b0f99-8df9-49c3-a6d5-056a524a5185</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Actually I&amp;#39;d take a different approach. Leverage the power of the database and create a VIEW that selects all of the data you want returned from the row, and in the selection criteria use the MAX(Index) WHERE &amp;quot;ApproverDecision&amp;#39; IS NOT NULL AND &amp;#39;ApproverDecisionDate&amp;#39; IS NOT NULL to select the one row you want returned. Now you have your VIEW it&amp;#39;ll be straightforward to simply return the content of that VIEW into Appian.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>