<?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>Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/discussions/f/data/26476/local-variable-query-rule-not-get-refresh-on-refreshvariable</link><description>Hi, 
 
 we are trying to refresh local variable value on var change but it is not working. PFB Code 
 a!localVariables( local!refreshOnVarChange: false, local!allMessages: a!refreshVariable( value: rule!DS_QRY_getMessageThread( returnDatasubset: false</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/104014?ContentTypeID=1</link><pubDate>Wed, 09 Nov 2022 03:23:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:499e5e6c-a7d9-4870-8548-9d5b9571695a</guid><dc:creator>Nikhil_Mahajan</dc:creator><description>&lt;p&gt;Hi Peter,&lt;/p&gt;
&lt;p&gt;Thank you so much!! It worked...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/104006?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 17:40:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:99b163a1-75ac-4832-8970-a9ffd611722f</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;yeah, that&amp;#39;s about the size of it.&amp;nbsp; to recap, afaik there are 4 mutually exclusive options/routes here:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;use no local variables at all in the rule&lt;/li&gt;
&lt;li&gt;use legacy with() local variables (&lt;em&gt;editor&amp;#39;s note: &lt;span style="text-decoration:underline;"&gt;please don&amp;#39;t&lt;/span&gt;&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;manually control refreshing within the rule using a refresh variable or via other referenced rule inputs (if applicable)&lt;/li&gt;
&lt;li&gt;use &amp;quot;refreshAlways&amp;quot; = TRUE&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In reality we&amp;#39;ll need to decide between options 1, 3, or 4 depending on our use case (using 1 or not will automatically be determined by whether you need to use local variables in the first place). There are pros and cons to both 3 and 4 - and it&amp;#39;ll always (afaik) depend on the use case; neither way is &amp;quot;right&amp;quot; or &amp;quot;wrong&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/104004?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 17:35:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b481d884-deea-45e2-b047-7edb70c541c9</guid><dc:creator>Chris</dc:creator><description>[quote userid="50400" url="~/discussions/f/data/26476/local-variable-query-rule-not-get-refresh-on-refreshvariable/104002#104002"]I&amp;#39;d expect it would also work if you set &amp;quot;refreshAlways&amp;quot; to true for the refreshVariable used in the rule.[/quote]
&lt;p&gt;That does in fact work within the rule - confirmed.&amp;nbsp; So we can bypass sending the reload counter input at least, but, still have to configure the child rule&amp;#39;s a!localVariables to refresh themselves, in any situation where you are trying to refresh parent data from that rule.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/104002?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 17:27:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bef1fbb4-46da-4b0e-806e-0e03020050e9</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I&amp;#39;d expect it would also work if you set &amp;quot;refreshAlways&amp;quot; to true for the refreshVariable used in the rule.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/104001?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 17:19:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:13c0d2b7-ad97-4abf-b129-c70efe25f730</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;As I noted, I hadn&amp;#39;t exhausted my research on this exact functionality yet&amp;nbsp;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f643.svg" title="Upside down"&gt;&amp;#x1f643;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;It seemed odd to me that when I told the parent interface&amp;#39;s refresh variable to &amp;#39;refresh&amp;#39; and basically &amp;#39;go get the latest value from the rule&amp;#39;, it would not do so.&amp;nbsp; In further testing, I confirmed we can make it refresh but this involves sending the reload counter (for refreshOnVarChange) down to the child rule also, meaning we have to modify a shared query rule with a new input just to allow it to refresh properly for this interface.&lt;/p&gt;
&lt;p&gt;So, basically what we have here is a layer of local variables, where the parent layer won&amp;#39;t force the child layer to refresh automatically unless the same manual refresh conditions are passed down to the child.&lt;/p&gt;
&lt;p&gt;I will submit that this isn&amp;#39;t exactly intuitive, this requires additional coding in any query rule which may be used under refresh conditions.&amp;nbsp; Where I just want to tell the parent interface, &amp;#39;go get me the latest value from the rule no matter what&amp;#39;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/104000?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 16:52:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:41ac264e-5454-4f78-9e67-0f9eadd7ffc0</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="2401" url="~/discussions/f/data/26476/local-variable-query-rule-not-get-refresh-on-refreshvariable/103998#103998"]but mainly when&amp;nbsp;a!localVariables() is not used[/quote]
&lt;p&gt;you need to remember two of the main default properties of the a!localVariables() behavior:&lt;/p&gt;
&lt;p&gt;1) it does NOT act with &amp;quot;refresh always&amp;quot; behavior unless set manually (meaning it acts slightly more like legacy &amp;quot;load()&amp;quot; than &amp;quot;with()&amp;quot;...&lt;/p&gt;
&lt;p&gt;2) it DOES default to a &amp;quot;refresh on referenced variable change&amp;quot; setting of TRUE - but this ONLY has any effect when &lt;em&gt;&lt;strong&gt;a referenced variable is actually changed&lt;/strong&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This all means if you&amp;#39;re storing a!queryEntity results somewhere in the expression rule in an &lt;em&gt;a!localVariables()&lt;/em&gt; variable, then it won&amp;#39;t refresh unless you pass a token into the expression rule that acts as a &amp;quot;manually refresh&amp;quot; agent.&amp;nbsp; This is easyish to do since you can just pass in an integer value like &amp;quot;ri!refreshCounter&amp;quot; etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/103999?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 16:48:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:12fc93f9-eb75-4e81-8b05-a36f97aa1506</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Sounds like you might have some other stuff down inside your expression rule gumming up the automatic refresh.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/103998?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 16:47:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:38611f00-02d7-4bf6-9d18-46aabe6f0d64</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;And I&amp;#39;ve been doing a little further testing this morning and was able to get this working with a!queryEntity() within a rule, in some situations, but mainly when&amp;nbsp;a!localVariables() is not used.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/103997?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 16:38:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6734e887-91ed-4f8c-a6fb-9c15cb24bd3d</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Adding my experience here - as this is something I&amp;#39;ve been tempted to start a thread on as well.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What I&amp;#39;ve seen is that if you have a refresh variable that calls a &lt;em&gt;&lt;strong&gt;rule&lt;/strong&gt; &lt;/em&gt;which contains a!queryEntity(), it will &lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;not refresh&lt;/strong&gt;&lt;/span&gt; automatically.&amp;nbsp; Simply moving the query out of the rule and into the main refresh variable, resolves the issue.&amp;nbsp; However, then you have duplicated code if other areas of the application use the rule to query data also.&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t exhausted the different scenarios here yet, but I was noticing this last while creating a small message board type app.&amp;nbsp; The main interface makes a post with a!writeToDataStoreEntity(), I trigger the local variable to refresh by incrementing a&amp;nbsp;reload counter used in refreshOnVarChange,&amp;nbsp;and in no situation can I get it to refresh without pulling the query out of the rule and pasting it in the main refresh variable.&amp;nbsp; Then, it works flawlessly.&lt;/p&gt;
&lt;p&gt;Would love to hear some other experiences on that as well..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/103994?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 15:03:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f8431f98-ddbf-4599-a70b-52b44f63bbfd</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I agree with Peter&amp;#39;s advice above - assuming the data being fetched is actually refreshing between your attempts to refresh it, what you have written here should basically work (though i&amp;#39;d use a different technique for your &amp;quot;local!refreshOnVarChange&amp;quot; variable).&amp;nbsp; Please post the code for the rule doing the query operation, as that could be preventing the refresh from occurring properly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/103993?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 15:01:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:377d2b0a-c981-4352-a9e8-4de6e6d5c7b7</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="86386" url="~/discussions/f/data/26476/local-variable-query-rule-not-get-refresh-on-refreshvariable/103979#103979"]try adding&amp;nbsp;&lt;strong&gt;refreshOnReferencedVarChange: false&amp;nbsp;&lt;/strong&gt;[/quote]
&lt;p&gt;The enclosed code snippet isn&amp;#39;t referencing any other variables, so this will actually make no difference.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/103991?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 14:14:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4e6f8c3d-9a7a-48a6-93f3-86df2aa9a248</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Is it possible you have a local variable defined inside of your rule DS_QRY_getMessageThread? If so, you likely also need to add a refresh variable within that rule and define refreshAlways: true.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/103982?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 12:18:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:51f48a27-8738-490e-9a99-19bec96b93e5</guid><dc:creator>Nikhil_Mahajan</dc:creator><description>&lt;p&gt;Yes but doesn&amp;#39;t work&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Local Variable (Query Rule) not get refresh on refreshVariable</title><link>https://community.appian.com/thread/103979?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 11:48:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3291494f-1a07-4b9a-9370-49842ff6f795</guid><dc:creator>raghulkrishna</dc:creator><description>&lt;p&gt;Can you try adding&amp;nbsp;&lt;strong&gt;refreshOnReferencedVarChange: false&amp;nbsp;&lt;/strong&gt;in your refreshVariable and check?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;pre class="ui-code" data-mode="text"&gt;local!allMessages: a!refreshVariable(
  value: rule!DS_QRY_getMessageThread(
    returnDatasubset: false,
    filters: a!queryFilter(
      field: &amp;quot;clientInboxId&amp;quot;,
      operator: &amp;quot;in&amp;quot;,
      value: { 15, 16 }
    )
  ),
  refreshOnReferencedVarChange: false,
  refreshOnVarChange: local!refreshOnVarChange
)&lt;/pre&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>