<?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>Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/discussions/f/new-to-appian/21146/expression-rule-call-within-editable-grid-cell-is-not-refreshing-after-saving-data-in-db</link><description>Hi, 
 I have a editable grid where in one field has single select dropdown (i.e Status), 
 
 
 
 
 and the value in the dropdown is populated from a expression rule file (below) which has different value for every status selected. 
 
 
 
 There is a button</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/thread/82432?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 14:47:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:132f65d0-e086-488c-bc6d-f82e180fe4a6</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Great, thanks for confirming/verifying &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/thread/82431?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 14:46:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8ba0c401-38d3-4423-97fe-e40e0f1bbf1e</guid><dc:creator>shamima0001</dc:creator><description>&lt;p&gt;Worked Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/thread/82430?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 14:38:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5141deb5-a5ad-4d0b-8376-65a5b6e895b7</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Oh - I don&amp;#39;t think you mentioned you&amp;#39;re using a!startProcess as opposed to a!writeToDataStoreEntity.&amp;nbsp; This is fine, though.&amp;nbsp; Can you check to ensure you have activity chaining enabled in the process model from the start node and all the way through to your WTDS node at least?&amp;nbsp; This is usually the solution to this sort of issue.&amp;nbsp; If chaining breaks early (or doesn&amp;#39;t exist) the &amp;quot;onSuccess&amp;quot; save(s) will happen too early (or immediately).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/thread/82429?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 14:18:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:70f3b119-61ec-4b3a-a579-95505d6651bf</guid><dc:creator>shamima0001</dc:creator><description>&lt;p&gt;Please have a look below&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!refreshCounter: 0,
  local!data: a!refreshVariable(
    value: rule!Data_Rule(
      serialNumber: null,
      pageBatchSize: -1
    ),
    refreshOnVarChange: local!refreshCounter
  ),
{
    a!gridLayout(
      label: &amp;quot;Editable Grid&amp;quot;,
      labelPosition: &amp;quot;COLLAPSED&amp;quot;,
      headerCells: {
        a!gridLayoutHeaderCell(label: &amp;quot;Serial Number&amp;quot;),
        a!gridLayoutHeaderCell(label: &amp;quot;Status&amp;quot;)
      },
      columnConfigs: {},
      rows: {
        a!forEach(
          items: local!data,
          expression: a!localVariables(
            local!statusToUpdate,
            a!gridRowLayout(
              contents: {
                a!textField(
                  label: &amp;quot;Serial Number&amp;quot;,
                  value: fv!item.serialNumber
                ),
                a!dropdownField(
                  label: &amp;quot;Status&amp;quot;,
                  labelPosition: &amp;quot;ABOVE&amp;quot;,
                  choiceLabels: rule!RWM_Status_Matrix_Rule(currentStatus:fv!item.currentStatus),
                  choiceValues: rule!RWM_Status_Matrix_Rule(currentStatus:fv!item.currentStatus),
                  value:if(not(isnull(local!statusToUpdate)),local!statusToUpdate,fv!item.currentStatus),
                  saveInto: {
                    a!save(local!statusToUpdate,save!value),
                    a!save(ri!dataList, save!value)
                  },
                  searchDisplay: &amp;quot;ON&amp;quot;,
                  required:true,
                  validations: {

                  }
                )                
              }
            )
          )
        )
      },
      selectionSaveInto: {},
      validations: {},
      shadeAlternateRows: true
    ),
    a!buttonArrayLayout(
      buttons: {
        a!buttonWidget(
          label: &amp;quot;Save&amp;quot;,
          style: &amp;quot;PRIMARY&amp;quot;,
          saveInto: {
            a!startProcess(
              processModel: cons!SAMPLE,
              processParameters: {
                /*Parameters to call Process Model which will update DB records*/
              },
              onSuccess: {
                a!save(local!refreshCounter,local!refreshCounter+1)               
              },
              onError:{
                /*Text error message*/
              }
            )
          }
        )
      },
      align: &amp;quot;END&amp;quot;
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/thread/82427?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 13:51:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5c5efcd8-09ed-4fe5-96a1-328d462f223f</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;That looks ok.&amp;nbsp; What I was fishing for was whether it uses local variables of the wrong configuration (&lt;em&gt;load()&lt;/em&gt; or &lt;em&gt;a!refreshVariable()&lt;/em&gt; with the wrong settings), but guess not.&lt;/p&gt;
&lt;p&gt;Can you post the code just for the saveInto section you&amp;#39;re trying, including whatever you&amp;#39;re calling to update the data and including the refresh counter increment?&amp;nbsp; My suspicion now is that the refresh is firing before the update is completed, but currently there&amp;#39;s not enough information posted to tell for sure.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/thread/82424?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 12:24:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5e8b8317-5725-4a3c-8e20-d82c78d70509</guid><dc:creator>shamima0001</dc:creator><description>&lt;p&gt;It has query to fetch data (below)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!queryEntity(
  entity: cons!DATA,
  query: a!query(
    logicalexpression: a!queryLogicalExpression(
      operator: &amp;quot;AND&amp;quot;,
      logicalExpressions: {
        a!queryLogicalExpression(
          ignoreFiltersWithEmptyValues: true,
          operator: &amp;quot;OR&amp;quot;,
          filters: {
            a!forEach(
              ri!namedsiteid,
              a!queryFilter(
                field: &amp;quot;namedsiteid&amp;quot;,
                operator: &amp;quot;includes&amp;quot;,
                value: fv!item
              )
            )
          }
        )
      },
      filters: {
        a!queryFilter(
          field: &amp;quot;serialnumber&amp;quot;,
          operator: &amp;quot;=&amp;quot;,
          value: ri!serialnumber
        )
      },
      ignoreFiltersWithEmptyValues: true
    ),
    selection: a!querySelection(
      columns: {
        a!forEach(
          {
            &amp;quot;serialnumber&amp;quot;,
            &amp;quot;status&amp;quot;
          },
          a!queryColumn(field: fv!item)
        )
      }
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: ri!pageBatchSize,
      sort: {
      a!sortInfo(
      field: &amp;quot;serialnumber&amp;quot;,
      ascending: true
      ),
      a!sortInfo(field: &amp;quot;status&amp;quot;, ascending: false)
      }
      )
  ),
  fetchTotalCount: false
).data&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/thread/82423?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 12:16:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8d9f86b5-ebfd-427f-92c8-a8b631a73bf1</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;What does the rule &lt;strong&gt;&lt;em&gt;rule!Data_Rule()&lt;/em&gt;&lt;/strong&gt; contain?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/thread/82416?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 07:33:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:07f43d96-27a0-47b0-a032-e1dc8fc7c0a3</guid><dc:creator>shamima0001</dc:creator><description>&lt;p&gt;&lt;span&gt;This does not seem to work, status dropdown is not refreshing, in fact the variable &amp;quot;local!refreshCounter&amp;quot; counter in increasing but the &amp;quot;local!data&amp;quot; is not refreshing.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/thread/82415?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 07:33:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:33507605-38e3-46d5-a1c0-9d54a1217592</guid><dc:creator>shamima0001</dc:creator><description>&lt;p&gt;This does not seem to work, status dropdown is not refreshing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/thread/82404?ContentTypeID=1</link><pubDate>Mon, 07 Jun 2021 14:13:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:45aa92fb-d0b6-4d5c-b517-b70559bdca70</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;You&amp;#39;ll need to make more extensive use of the neat new capabilities available in the new a!localVariables() toolset, specifically a!refreshVariable settings.&amp;nbsp; The following represents my normal technique for doing this sort of thing:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!refreshCounter: 0,
  local!data: a!refreshVariable(
    value: rule!Data_Rule(
      serialNumber: null,
      pageBatchSize: -1
    ),
    refreshOnVarChange: {
      local!refreshCounter
    }
  ),
  local!statusToUpdate,
  
  {
    a!gridLayout(
      label: &amp;quot;Editable Grid&amp;quot;,
      labelPosition: &amp;quot;COLLAPSED&amp;quot;,
      headerCells: {
        a!gridLayoutHeaderCell(label: &amp;quot;Serial Number&amp;quot;),
        a!gridLayoutHeaderCell(label: &amp;quot;Status&amp;quot;)
      },
      columnConfigs: {},
      rows: {
        a!forEach(
          items: local!data,
          expression: {
            a!gridRowLayout(
              contents: {
                a!textField(
                  label: &amp;quot;Serial Number&amp;quot;,
                  value: fv!item.serialNumber
                ),
                a!dropdownField(
                  label: &amp;quot;Status&amp;quot;,
                  labelPosition: &amp;quot;ABOVE&amp;quot;,
                  choiceLabels: rule!RWM_Status_Matrix_Rule(currentStatus:fv!item.currentStatus),
                  choiceValues: rule!RWM_Status_Matrix_Rule(currentStatus:fv!item.currentStatus),
                  value:if(not(isnull(local!statusToUpdate)),local!statusToUpdate,fv!item.currentStatus),
                  saveInto: {
                    a!save(local!statusToUpdate,save!value),
                    a!save(ri!dataList, save!value)
                  },
                  searchDisplay: &amp;quot;ON&amp;quot;,
                  required:true,
                  validations: {

                  }
                )                
              }
            )
          }
        )
      },
      selectionSaveInto: {},
      validations: {},
      shadeAlternateRows: true
    ),
    a!buttonArrayLayout(
      buttons: {
        a!buttonWidget(
          label: &amp;quot;Save&amp;quot;,
          style: &amp;quot;PRIMARY&amp;quot;,
          saveInto: {
            /*Code to write updated value in DB*/
            
            a!writeToDataStoreEntity(
              dataStoreEntity: cons!ASDF_MY_DSE,
              valueToStore: {/* value */},
              onSuccess: {
                a!save(
                  local!refreshCounter,
                  local!refreshCounter + 1
                )
              }
            )
          }
        )
      },
      align: &amp;quot;END&amp;quot;
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression Rule call within editable grid cell is not refreshing after saving data in DB</title><link>https://community.appian.com/thread/82401?ContentTypeID=1</link><pubDate>Mon, 07 Jun 2021 13:43:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0835a823-0c6b-42ea-8f38-5a66cab86cf6</guid><dc:creator>Danny Verb</dc:creator><description>&lt;p&gt;Since local!data is populating your grid, you should refresh local!data when you click save.&amp;nbsp;I recommending calling rule!Data_Rule() in the onSuccess parameter of a!writeToDataStoreEntity. If you are writing to the database using a!startProcess() you can do the same thing however you first need to make sure in your process model that you chain the process through the write to DB node.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>