<?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>How to save data identifier into a local variable in a readonly grid?</title><link>https://community.appian.com/discussions/f/rules/38316/how-to-save-data-identifier-into-a-local-variable-in-a-readonly-grid</link><description>Hi everyone, I&amp;#39;m facing issue while saving unique identifier value into a local variable. By default indexes are getting saved but I want to save the identifier value so that even if custom filters are applied only the actual selected value is checked</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to save data identifier into a local variable in a readonly grid?</title><link>https://community.appian.com/thread/144363?ContentTypeID=1</link><pubDate>Wed, 15 Jan 2025 09:11:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fa7737d3-c17c-4411-b45d-e8024d1a0999</guid><dc:creator>deepakrana77</dc:creator><description>&lt;p&gt;Thanks Stefan!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save data identifier into a local variable in a readonly grid?</title><link>https://community.appian.com/thread/144340?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2025 19:37:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:84a8b278-5888-4e44-86f9-757a17fcff88</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Directly storing the identifiers works like a charm!&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!selection: {},
  local!pInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 5,
    sort: a!sortInfo(&amp;quot;name&amp;quot;, true)
  ),
  local!employeeList: {
    {
      id: 11,
      name: &amp;quot;Sophia Turner&amp;quot;,
      dept: &amp;quot;Marketing&amp;quot;
    },
    {
      id: 22,
      name: &amp;quot;Liam Brown&amp;quot;,
      dept: &amp;quot;Operations&amp;quot;
    },
    {
      id: 33,
      name: &amp;quot;Emma Davis&amp;quot;,
      dept: &amp;quot;Product Management&amp;quot;
    },
    {
      id: 44,
      name: &amp;quot;Oliver Martinez&amp;quot;,
      dept: &amp;quot;Engineering&amp;quot;
    },
    {
      id: 55,
      name: &amp;quot;Ava Wilson&amp;quot;,
      dept: &amp;quot;Customer Support&amp;quot;
    },
    { id: 66, name: &amp;quot;Noah Garcia&amp;quot;, dept: &amp;quot;Sales&amp;quot; },
    {
      id: 77,
      name: &amp;quot;Isabella Lee&amp;quot;,
      dept: &amp;quot;Human Resources&amp;quot;
    },
    { id: 88, name: &amp;quot;James Smith&amp;quot;, dept: &amp;quot;IT&amp;quot; },
    {
      id: 99,
      name: &amp;quot;Mia Johnson&amp;quot;,
      dept: &amp;quot;Finance&amp;quot;
    },
    { id: 111, name: &amp;quot;Ethan Brown&amp;quot;, dept: &amp;quot;Legal&amp;quot; }
  },

  /* Just sort the data */
  local!sortedAndPaged: todatasubset(
    local!employeeList,
    local!pInfo
  ),
  
  /* The wrap it into a DS */
  local!ds: a!dataSubset(
    data: local!sortedAndPaged.data,
    startIndex: local!pInfo.startIndex,
    batchSize: local!pInfo.batchSize,
    sort: local!pInfo.sort,
    totalCount: count(local!employeeList),
    identifiers: index(local!sortedAndPaged.data, &amp;quot;id&amp;quot;, {})
  ),

  {
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!gridField(
              label: &amp;quot;Employee Directory&amp;quot;,
              data: local!ds,
              columns: {
                a!gridColumn(
                  label: &amp;quot;Name&amp;quot;,
                  sortField: &amp;quot;name&amp;quot;,
                  value: fv!row.name
                ),
                a!gridColumn(
                  label: &amp;quot;Department&amp;quot;,
                  sortField: &amp;quot;dept&amp;quot;,
                  value: fv!row.dept
                )
              },
              selectable: true(),
              selectionValue: local!selection,
              selectionSaveInto: local!selection,
              pagingSaveInto: local!pInfo
            )
          }
        )
      }
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save data identifier into a local variable in a readonly grid?</title><link>https://community.appian.com/thread/144338?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2025 18:39:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2e5f5da4-3d2c-415f-bf67-50da46e09a47</guid><dc:creator>deepakrana77</dc:creator><description>&lt;p&gt;Ah in the chaotic identifier search I didn&amp;#39;t thought the other way around. The OG wherecontains did the trick, thanks for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save data identifier into a local variable in a readonly grid?</title><link>https://community.appian.com/thread/144337?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2025 18:08:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:097882ba-c37a-4963-97d8-b8b626f382d9</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;try this variation:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!selection: {},
  local!selectedEmployees,
  local!employeeList: {
    {
      id: 11,
      name: &amp;quot;Sophia Turner&amp;quot;,
      dept: &amp;quot;Marketing&amp;quot;
    },
    {
      id: 22,
      name: &amp;quot;Liam Brown&amp;quot;,
      dept: &amp;quot;Operations&amp;quot;
    },
    {
      id: 33,
      name: &amp;quot;Emma Davis&amp;quot;,
      dept: &amp;quot;Product Management&amp;quot;
    },
    {
      id: 44,
      name: &amp;quot;Oliver Martinez&amp;quot;,
      dept: &amp;quot;Engineering&amp;quot;
    },
    {
      id: 55,
      name: &amp;quot;Ava Wilson&amp;quot;,
      dept: &amp;quot;Customer Support&amp;quot;
    },
    { id: 66, name: &amp;quot;Noah Garcia&amp;quot;, dept: &amp;quot;Sales&amp;quot; },
    {
      id: 77,
      name: &amp;quot;Isabella Lee&amp;quot;,
      dept: &amp;quot;Human Resources&amp;quot;
    },
    { id: 88, name: &amp;quot;James Smith&amp;quot;, dept: &amp;quot;IT&amp;quot; },
    {
      id: 99,
      name: &amp;quot;Mia Johnson&amp;quot;,
      dept: &amp;quot;Finance&amp;quot;
    },
    { id: 111, name: &amp;quot;Ethan Brown&amp;quot;, dept: &amp;quot;Legal&amp;quot; }
  },
  
  local!ds: a!dataSubset(
    data: local!employeeList,
    startIndex: 1,
    batchSize: -1,
    totalCount: length(local!employeeList),
    identifiers: index(local!employeeList, &amp;quot;id&amp;quot;, {})
  ),
  
  {
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!gridField(
              label: &amp;quot;Employee Directory&amp;quot;,
              data: todatasubset(
                arrayToPage: local!employeeList,
                pagingConfiguration: fv!pagingInfo
              ),
              columns: {
                a!gridColumn(
                  label: &amp;quot;Name&amp;quot;,
                  sortField: &amp;quot;name&amp;quot;,
                  value: fv!row.name
                ),
                a!gridColumn(
                  label: &amp;quot;Department&amp;quot;,
                  sortField: &amp;quot;dept&amp;quot;,
                  value: fv!row.dept
                )
              },
              pageSize: 5,
              selectable: true(),
              selectionValue: wherecontains(local!selection, local!employeeList.id),
              selectionSaveInto: {
                a!save(
                  local!selection,
                  if(
                    a!isNullOrEmpty(save!value),
                    {},
                    property(
                      index(local!employeeList, save!value, {}),
                      &amp;quot;id&amp;quot;,
                      {}
                    )
                  )
                ),
                
                /*a!save(
                  local!selectedEmployees,
                  index(
                    fv!selectedRows,
                    length(fv!selectedRows),
                    null
                  )
                )*/
              }
            )
          }
        )
      }
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save data identifier into a local variable in a readonly grid?</title><link>https://community.appian.com/thread/144336?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2025 17:58:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dcb6f271-6a19-438e-856a-d13b784f1f8d</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;you might need to consider handling converting the index to the primary key at the time of saving / retrieving row selections.&amp;nbsp; in the old iteration of paging grid, we were actually able to pass in the identifiers manually (though in many other ways it was far more painful to use), but that went away as of the 19.2 (modern) version.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save data identifier into a local variable in a readonly grid?</title><link>https://community.appian.com/thread/144335?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2025 17:52:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a038fc4c-491b-4afc-85cb-49bd040b2df3</guid><dc:creator>deepakrana77</dc:creator><description>&lt;p&gt;Hey&amp;nbsp;&lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="/members/stefanhelzle0001"&gt;Stefan Helzle&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="xml"&gt;a!localVariables(
  local!selection,
  local!selectedEmployees,
  local!employeeDS: {
    {
      id: 11,
      name: &amp;quot;Sophia Turner&amp;quot;,
      dept: &amp;quot;Marketing&amp;quot;
    },
    {
      id: 22,
      name: &amp;quot;Liam Brown&amp;quot;,
      dept: &amp;quot;Operations&amp;quot;
    },
    {
      id: 33,
      name: &amp;quot;Emma Davis&amp;quot;,
      dept: &amp;quot;Product Management&amp;quot;
    },
    {
      id: 44,
      name: &amp;quot;Oliver Martinez&amp;quot;,
      dept: &amp;quot;Engineering&amp;quot;
    },
    {
      id: 55,
      name: &amp;quot;Ava Wilson&amp;quot;,
      dept: &amp;quot;Customer Support&amp;quot;
    },
    { id: 66, name: &amp;quot;Noah Garcia&amp;quot;, dept: &amp;quot;Sales&amp;quot; },
    {
      id: 77,
      name: &amp;quot;Isabella Lee&amp;quot;,
      dept: &amp;quot;Human Resources&amp;quot;
    },
    { id: 88, name: &amp;quot;James Smith&amp;quot;, dept: &amp;quot;IT&amp;quot; },
    {
      id: 99,
      name: &amp;quot;Mia Johnson&amp;quot;,
      dept: &amp;quot;Finance&amp;quot;
    },
    { id: 111, name: &amp;quot;Ethan Brown&amp;quot;, dept: &amp;quot;Legal&amp;quot; }
  },
  local!ds: a!dataSubset(
    data: local!employeeDS,
    startIndex: 1,
    batchSize: - 1,
    totalCount: length(local!employeeDS),
    identifiers: index(local!employeeDS, &amp;quot;id&amp;quot;, {})
  ),
  {
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!gridField(
              label: &amp;quot;Employee Directory&amp;quot;,
              data: todatasubset(
                arrayToPage: local!ds,
                pagingConfiguration: fv!pagingInfo
              ),
              columns: {
                a!gridColumn(
                  label: &amp;quot;Name&amp;quot;,
                  sortField: &amp;quot;name&amp;quot;,
                  value: fv!row.name
                ),
                a!gridColumn(
                  label: &amp;quot;Department&amp;quot;,
                  sortField: &amp;quot;dept&amp;quot;,
                  value: fv!row.dept
                )
              },
              pageSize: 5,
              selectable: true,
              selectionValue: local!selection,
              selectionSaveInto: {
                local!selection,
                a!save(
                  local!selectedEmployees,
                  index(
                    fv!selectedRows,
                    length(fv!selectedRows),
                    null
                  )
                )
              }
            )
          }
        )
      }
    )
  }
)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To simplify my question, I need to add pagination to the code above. How can I achieve this given I need the id to be stored in local!selection.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save data identifier into a local variable in a readonly grid?</title><link>https://community.appian.com/thread/144319?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2025 16:12:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1a5aa761-f9d9-45b9-9d05-58916ec6b2a0</guid><dc:creator>deepakrana77</dc:creator><description>&lt;p&gt;I&amp;#39;m getting data from an external system, I need to show it on a grid which has custom filters. Using read only grid which automatically saves the identifier(if available) or the index of the list to the selection value. (For the checkbox or selection type)&lt;br /&gt;I need the data identifier to be saved so that even the filters changes the source data the checkbox is still selected for the already checked item and not just based on the index.&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It&amp;#39;s a read only multi selectable grid.&amp;nbsp;&lt;/span&gt;The screenshot above is just for reference to show todatasubset is not able to override paging which is setted up by a!todatasubset.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save data identifier into a local variable in a readonly grid?</title><link>https://community.appian.com/thread/144318?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2025 16:04:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:747d6dbb-62f8-45b0-8c80-ba0404e60c81</guid><dc:creator>deepakrana77</dc:creator><description>&lt;p&gt;Data is from an external system so we can assume it to be a list of map. It is a multi selectable grid with custom filters.&lt;br /&gt;&lt;br /&gt;I converted it to a datasubset and provided it with an identifier. It works but now the paging is messed up for me since todatasubet is not able to over ride the initial paging. Also, if I try to play around directly with a!datasubset paging then it gives me again an error stating that batch size should be same like number of elements in the list.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save data identifier into a local variable in a readonly grid?</title><link>https://community.appian.com/thread/144316?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2025 15:57:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e5e1fd9e-040d-4214-9fa8-408f5f3321c7</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;I do not feel very confident that I understand what you are trying to do. Can you help me out with more background, details and an explanation?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save data identifier into a local variable in a readonly grid?</title><link>https://community.appian.com/thread/144311?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2025 14:47:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:046a3356-c2ed-4f48-82d0-fc700e9847fb</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;What will the real source for your data be?&amp;nbsp; When you&amp;#39;re querying from a data store entity, the data subset you start with includes the primary key IDs as the &amp;quot;identifiers&amp;quot; by default.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>