<?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>Read only Grid</title><link>https://community.appian.com/discussions/f/general/39458/read-only-grid</link><description>Hello Everyone, 
 I have a read only grid component with 20 rows of data and displays 5 rows for each page with id and product price. 
 How can we add a logic to display the sum of the data display on bottom of the page for read only grid for each page</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Read only Grid</title><link>https://community.appian.com/thread/149963?ContentTypeID=1</link><pubDate>Tue, 15 Jul 2025 17:39:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dfd538b2-6af6-4865-a210-1ad8cfe469b1</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;We have implemented similar requirement i made few changes as per your need.&lt;br /&gt;&lt;br /&gt;Let me know if that works for you.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;

a!localVariables(
  /* Your complete dataset */
  local!allData: {
    a!map(id: 1, price: 1234),
    a!map(id: 2, price: 1243),
    a!map(id: 3, price: 1234),
    a!map(id: 4, price: 1243),
    a!map(id: 5, price: 1234),
    a!map(id: 6, price: 1243),
    a!map(id: 7, price: 1234),
    a!map(id: 8, price: 1243),
    a!map(id: 9, price: 1234),
    a!map(id: 10, price: 1243),
    a!map(id: 11, price: 1500),
    a!map(id: 12, price: 1600),
    a!map(id: 13, price: 1700),
    a!map(id: 14, price: 1800),
    a!map(id: 15, price: 1900),
    a!map(id: 16, price: 2000),
    a!map(id: 17, price: 2100),
    a!map(id: 18, price: 2200),
    a!map(id: 19, price: 2300),
    a!map(id: 20, price: 2400)
  },

  /* Grid configuration */
  local!pageSize: 5,

  /* Initialize paging */
  local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: local!pageSize
  ),

  /* Create data subset for grid using todatasubset() */
  local!dataSubset: todatasubset(
    arrayToPage: local!allData,
    pagingConfiguration: local!pagingInfo
  ),

  /* DYNAMIC CALCULATION LOGIC */
  /* Calculate which items are on current page */
  local!currentPageItems: if(
    a!isNullOrEmpty(local!dataSubset.data),
    {},
    local!dataSubset.data
  ),

  /* Calculate sum of current page items */
  local!pageSum: sum(
    a!forEach(
      items: local!currentPageItems,
      expression: if(
        a!isNullOrEmpty(fv!item.price),
        0,
        tointeger(fv!item.price)
      )
    )
  ),

  /* Calculate current page number for display */
  local!currentPageNumber: ceiling(local!pagingInfo.startIndex / local!pageSize),

  /* Calculate range for display */
  local!rangeStart: local!pagingInfo.startIndex,
  local!rangeEnd: min(
    local!pagingInfo.startIndex + length(local!currentPageItems) - 1,
    length(local!allData)
  ),

  {
    /* Main Grid */
    a!gridField(
      label: &amp;quot;Product Price Grid&amp;quot;,
      labelPosition: &amp;quot;ABOVE&amp;quot;,
      data: local!dataSubset,
      columns: {
        a!gridColumn(
          label: &amp;quot;ID&amp;quot;,
          value: fv!row.id,
          align: &amp;quot;CENTER&amp;quot;,
          width: &amp;quot;ICON_PLUS&amp;quot;
        ),
        a!gridColumn(
          label: &amp;quot;Product Price&amp;quot;,
          value: a!currency(
            isoCode: &amp;quot;USD&amp;quot;,
            value: fv!row.price
          ),
          align: &amp;quot;END&amp;quot;
        )
      },
      pagingSaveInto: {
        local!pagingInfo,
        /* Update data subset using todatasubset() */
        a!save(
          local!dataSubset,
          todatasubset(
            arrayToPage: local!allData,
            pagingConfiguration: local!pagingInfo
          )
        ),
        /* Update current page items */
        a!save(
          local!currentPageItems,
          if(
            a!isNullOrEmpty(local!dataSubset.data),
            {},
            local!dataSubset.data
          )
        ),
        /* Recalculate sum */
        a!save(
          local!pageSum,
          sum(
            a!forEach(
              items: local!currentPageItems,
              expression: if(
                a!isNullOrEmpty(fv!item.price),
                0,
                tointeger(fv!item.price)
              )
            )
          )
        ),
        /* Update page number */
        a!save(
          local!currentPageNumber,
          ceiling(local!pagingInfo.startIndex / local!pageSize)
        ),
        /* Update range */
        a!save(
          local!rangeStart,
          local!pagingInfo.startIndex
        ),
        a!save(
          local!rangeEnd,
          min(
            local!pagingInfo.startIndex + length(local!currentPageItems) - 1,
            length(local!allData)
          )
        )
      },
      borderStyle: &amp;quot;LIGHT&amp;quot;,
      shadeAlternateRows: true,
      spacing: &amp;quot;DENSE&amp;quot;,
      rowHeader: 1
    ),

    /* Page Sum Display */
    a!boxLayout(
      label: &amp;quot;&amp;quot;,
      contents: {
        a!sideBySideLayout(
          items: {
            a!sideBySideItem(
              item: a!richTextDisplayField(
                value: {
                  a!richTextIcon(
                    icon: &amp;quot;calculator&amp;quot;,
                    color: &amp;quot;ACCENT&amp;quot;
                  ),
                  a!richTextItem(
                    text: concat(
                      &amp;quot; Page &amp;quot;,
                      local!currentPageNumber,
                      &amp;quot; Sum (Items &amp;quot;,
                      local!rangeStart,
                      &amp;quot;-&amp;quot;,
                      local!rangeEnd,
                      &amp;quot;):&amp;quot;
                    ),
                    size: &amp;quot;MEDIUM&amp;quot;
                  )
                }
              ),
              width: &amp;quot;AUTO&amp;quot;
            ),
            a!sideBySideItem(
              item: a!richTextDisplayField(
                value: {
                  a!richTextItem(
                    text: a!currency(
                      isoCode: &amp;quot;USD&amp;quot;,
                      value: local!pageSum
                    ),
                    size: &amp;quot;LARGE&amp;quot;,
                    style: &amp;quot;STRONG&amp;quot;,
                    color: &amp;quot;POSITIVE&amp;quot;
                  )
                },
                align: &amp;quot;RIGHT&amp;quot;
              )
            )
          },
          alignVertical: &amp;quot;MIDDLE&amp;quot;
        )
      },
      style: &amp;quot;INFO&amp;quot;,
      marginAbove: &amp;quot;STANDARD&amp;quot;
    ),

    /* Additional Information */
    a!richTextDisplayField(
      value: {
        a!richTextItem(
          text: &amp;quot;Total Records: &amp;quot;,
          color: &amp;quot;SECONDARY&amp;quot;
        ),
        a!richTextItem(
          text: length(local!allData),
          style: &amp;quot;STRONG&amp;quot;
        ),
        a!richTextItem(
          text: &amp;quot; | Grand Total: &amp;quot;,
          color: &amp;quot;SECONDARY&amp;quot;
        ),
        a!richTextItem(
          text: a!currency(
            isoCode: &amp;quot;USD&amp;quot;,
            value: sum(
              a!forEach(
                items: local!allData,
                expression: tointeger(fv!item.price)
              )
            )
          ),
          style: &amp;quot;STRONG&amp;quot;
        )
      },
      align: &amp;quot;CENTER&amp;quot;,
      marginAbove: &amp;quot;STANDARD&amp;quot;
    )
  }
)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read only Grid</title><link>https://community.appian.com/thread/149962?ContentTypeID=1</link><pubDate>Tue, 15 Jul 2025 16:32:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c81654be-8514-4601-bc50-9488bfb2bbf7</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;The solution is probably to do some tricky post-processing on your local variable that holds your paged data set, inserting a fake row at the end for each page that contains the calculated value.&amp;nbsp; I haven&amp;#39;t tried this approach (at least not recently) so it may be more tricky and/or clunky than it&amp;#39;s worth for you, but it&amp;#39;s probably worth a try.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>