<?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>Query rule substitute</title><link>https://community.appian.com/discussions/f/user-interface/19108/query-rule-substitute</link><description>Hi, 
 
 As you know Query Rule has been deprecated in newer versions of Appian. I need a function that will mimic the exact behaviour of Query rule including the return type. 
 I have tried using queryEntity() but the return type is not the same as query</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Query rule substitute</title><link>https://community.appian.com/thread/76592?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 13:45:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cc64b237-bfb0-4833-b9c8-0abb4d6d825c</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="23507" url="~/discussions/f/user-interface/19108/query-rule-substitute/76571"]Cannot index property &amp;#39;ABC&amp;#39; into type Dictionary[/quote]
&lt;p&gt;This is a standard error message when you&amp;#39;re trying to access a property that doesn&amp;#39;t exist - usually if you have the column name wrong, or if your query has resulted in zero rows.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query rule substitute</title><link>https://community.appian.com/thread/76582?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 12:35:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e046dca9-535a-40f9-9879-6767bab307f9</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;It sounds like you&amp;#39;re saving your query result into a local variable.&amp;nbsp; Local variables take on the datatype of whatever they contain.&amp;nbsp; So I think typeof() of your local variable would return &amp;quot;Dictionary&amp;quot;.&amp;nbsp; In that case, I wouldn&amp;#39;t try wrapping the query entity expression rule in a cast() function, but I would try wrapping the call to that query entity rule in a cast() right there in your local! definition.&amp;nbsp; typeof() might be a good test to run first to make sure that part is working.&lt;/p&gt;
&lt;p&gt;What&amp;#39;s possibly occurring is you sometimes return a null for a particular column, and so when Appian is building a Dictionary in particular, it saves space by not saving the null.&amp;nbsp; Either that or it&amp;#39;s the fact that for Dictionary to work it requires both key AND value.&amp;nbsp; None of the Dictionaries in your list of them need to have identical sets of keys.&amp;nbsp; But if you cast it as a list of CDT, they all DO have to have the same keys.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query rule substitute</title><link>https://community.appian.com/thread/76571?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 07:54:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b61787ae-e21b-4280-b2f0-806d888877dd</guid><dc:creator>apoorvam</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;, thanks for your response.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have executed the same QE logic where i am fetching all the columns and using .data&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am able to retrive the data and display on the interface. But when I try to SaveInto the column it gives me the following error. Say if the column name is &amp;quot;ABC&amp;quot;, then the error is this -&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong class="StrongText---richtext_strong StrongText---inMessageLayout StrongText---error"&gt;Could not display interface. Please check definition and inputs.&lt;/strong&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Interface Definition: Expression evaluation error [evaluation ID = SM7UJSZM] : An error occurred while executing a save: java.lang.IllegalArgumentException: Invalid index: Cannot index property &amp;#39;ABC&amp;#39; into type Dictionary&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have tried to use cast as well giving the type of the datatype but still getting the same error.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query rule substitute</title><link>https://community.appian.com/thread/74904?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 13:21:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:558f9585-0161-4290-a09c-b38040c6a5e9</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Keep in mind also that traditional query rules will pass back a &amp;quot;dataSubset&amp;quot; type whenever pagingInfo is passed in.&lt;/p&gt;
&lt;p&gt;Given this, I&amp;#39;ve previously set up a standard QE recipe which I usually make a new version of for each CDT i might be querying.&amp;nbsp; In that QE expression rule, I run the query entity as normal (using the passed-in pagingInfo if it was given, and a generic set otherwise); then I return the whole dataSubset if the pagingInfo was provided, and return just the &amp;quot;.data&amp;quot; result from the query entity otherwise.&lt;/p&gt;
&lt;p&gt;Note that this does return basically an &amp;quot;any type&amp;quot; dictionary instead of a type-cast CDT.&amp;nbsp; I&amp;#39;ve almost never had an issue with this - it does mean that a very few things need to be manually typecast when these are used.&amp;nbsp; You could take the subsequent step of typecasting your &amp;quot;.data&amp;quot; output as the CDT type, but this creates its own issues (such as, if the QE returns a selected set of columns instead of all columns).&lt;/p&gt;
&lt;p&gt;What exactly is your use case for needing the exact return type?&amp;nbsp; What issues is this causing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query rule substitute</title><link>https://community.appian.com/thread/74893?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 10:20:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0fed1741-1b37-40e0-995d-6293d5d18bf5</guid><dc:creator>Sanghapriya Bose</dc:creator><description>&lt;p&gt;The default output&amp;nbsp;format of a queryentity is a datasubset, in order to get the data in the same format of a query rule, you can try to slice the data part of the query entity result.&amp;nbsp;&lt;br /&gt;You can either use the index function like index(local!output,&amp;quot;data&amp;quot;,null) or just local!output.data. This would give you a dictionary type object. You can directly use in a CDT type rule input.&lt;br /&gt;As mentioned below by &lt;a href="/members/manuelh0002"&gt;ManuelHTG&lt;/a&gt; you can use cast on top of the result set if you need to convert the output to a specific cdt.&lt;br /&gt;&lt;br /&gt;Also query rules used to return all the columns whereas queryentity only returns specific columns, this can be achieved by not passing any query selection parameter to the queryentity.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query rule substitute</title><link>https://community.appian.com/thread/74890?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 09:17:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:34a4f9c6-8b84-43e3-8678-0827e958f9ec</guid><dc:creator>ManuelHTG</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;See documentation&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.appian.com/suite/help/20.2/Query_Recipes.html"&gt;https://docs.appian.com/suite/help/20.2/Query_Recipes.html&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you want to return the same data type, then you need to add as well the cast() function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>