<?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 a row order in grid</title><link>https://community.appian.com/discussions/f/new-to-appian/37452/how-to-save-a-row-order-in-grid</link><description>Hi All, 
 I&amp;#39;m a beginner of Appian, and I would like to know how to save a row order in a grid. 
 In a grid in an interface, I put a arrow for up and down to move rows. 
 I need to save the order, so the changed order should be saved and updated to DB</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140301?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 04:06:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b0219d95-55a5-45fc-99af-5837c1f7c95e</guid><dc:creator>saitoy6477</dc:creator><description>&lt;p&gt;thank you so much!! I will try&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140300?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 03:14:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:821fe84d-ed6e-47c2-83ca-13dc76299653</guid><dc:creator>Kumar Agniwesh</dc:creator><description>&lt;p&gt;You can build it. Play around with RichtextdisplayField and you shall be able to achieve it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140299?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 02:53:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:19e1da79-6ea7-4e63-abfd-67226427d8be</guid><dc:creator>saitoy6477</dc:creator><description>&lt;p&gt;not exactly the same as the following screenshot, right? The following one is not possible in an editable grid?&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/62/pastedimage1725504749456v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140298?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 02:38:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5a54cf8f-b32d-44a5-a934-47de6a386c84</guid><dc:creator>Kumar Agniwesh</dc:creator><description>&lt;p&gt;You can do that using pagination and implementing buttons to move to next and previous pages. Below is the link with discussion on the topic&lt;br /&gt;&lt;a href="https://community.appian.com/discussions/f/data/27359/next-and-back-button-for-records-in-a-read-only-grid/107262"&gt;community.appian.com/.../107262&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140297?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 02:34:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:75ca7fea-e6b7-49a8-9b2c-09f9e3271984</guid><dc:creator>saitoy6477</dc:creator><description>&lt;p&gt;is it possible to break page for the grid?&amp;nbsp;gridField seems to have a &amp;quot;break page &amp;quot; as &amp;quot;page size&amp;quot;, but editable grid &amp;quot;gridlayout&amp;quot; does not seem to have the &amp;quot;break page&amp;quot;.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140273?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 08:41:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f2beb034-22f8-4cbb-a9bc-2e8b7e619447</guid><dc:creator>Kumar Agniwesh</dc:creator><description>&lt;p&gt;Thanks&amp;nbsp;&lt;a href="/members/stefanhelzle0001"&gt;Stefan Helzle&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;will change the code and would also add some comments as well&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140272?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 08:35:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:96d184d1-0006-4142-bd1c-c0ff50b0e181</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;A simple approach to swap items in a list is this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!update(
  ri!list,
  {ri!index1, ri!index2},
  {ri!list[ri!index2], ri!list[ri!index1]}
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I created a utility expression that includes some range and null checks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140270?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 08:24:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ebdff2e7-048c-4ba5-a240-29551c5eecfa</guid><dc:creator>Guduri Durga Pavan SriHari Raju</dc:creator><description>&lt;p&gt;Sure&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140265?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 06:07:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:652c1abe-2d2f-4b89-80a5-38b9bb5b5c09</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/62/pastedimage1725430053751v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Makes code more readable.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140261?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 21:52:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cf284c5f-43c1-4b18-8f0c-87c72803d743</guid><dc:creator>saitoy6477</dc:creator><description>&lt;p&gt;Thank you! I will try.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140260?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 21:51:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dec1138a-77c1-4fea-ae0f-28322567c341</guid><dc:creator>saitoy6477</dc:creator><description>&lt;p&gt;thank you! I will try!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140239?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 14:25:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0690590f-b2a5-406c-b278-7d591a2e773c</guid><dc:creator>Guduri Durga Pavan SriHari Raju</dc:creator><description>&lt;p&gt;&amp;nbsp;&lt;a href="/members/saitoy6477"&gt;saitoy6477&lt;/a&gt;&amp;nbsp;You can use a Id with the above map data . Id will uniquely identify each record same as like Db primary key . You can use below code i just tried for down functionality you can use same for Up as well .&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
local!items: {
{ id: 1, item: &amp;quot;Item 1&amp;quot;, qty: 1, unitPrice: 10 },
{ id: 2, item: &amp;quot;Item 2&amp;quot;, qty: 2, unitPrice: 20 }
},
a!gridLayout(
label: &amp;quot;Products&amp;quot;,
instructions: &amp;quot;Update the item name, quantity, or unit price.&amp;quot;,
headerCells: {
a!gridLayoutHeaderCell(label: &amp;quot;Item&amp;quot;),
a!gridLayoutHeaderCell(label: &amp;quot;Qty&amp;quot;),
a!gridLayoutHeaderCell(label: &amp;quot;Unit Price&amp;quot;),
a!gridLayoutHeaderCell(label: &amp;quot;Total&amp;quot;, align: &amp;quot;RIGHT&amp;quot;),
a!gridLayoutHeaderCell(label: &amp;quot; &amp;quot;),

},
rows: a!forEach(
items: local!items,
expression: a!gridRowLayout(
contents: {
a!textField(
value: fv!item.item,
saveInto: fv!item.item
),
a!integerField(value: fv!item.qty, saveInto: fv!item.qty),
a!floatingPointField(
value: fv!item.unitPrice,
saveInto: fv!item.unitPrice
),
a!textField(
value: a!currency(
isoCode: &amp;quot;USD&amp;quot;,
value: tointeger(fv!item.qty) * todecimal(fv!item.unitPrice)
),
readOnly: true,
align: &amp;quot;RIGHT&amp;quot;
),
a!richTextDisplayField(
value: {
a!richTextIcon(
icon: &amp;quot;arrow-circle-down&amp;quot;,
showWhen: not(fv!isLast),
link: a!dynamicLink(
saveInto: {
a!save(
local!items,
a!update(
local!items,
{fv!index,fv!index+1},
{index(local!items,(fv!index+1),null()),fv!item}
)
)
}
)
),
a!richTextIcon(icon: &amp;quot;arrow-circle-up&amp;quot;)
}
)
}
)
),
rowHeader: 1
)
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140232?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 13:54:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:060486f6-570f-4c8d-a3c3-c8bc889b5145</guid><dc:creator>Stefan Helzle</dc:creator><description>[quote userid="267580" url="~/discussions/f/new-to-appian/37452/how-to-save-a-row-order-in-grid"]I should create a column in DB to save a row order, but it does not work.[/quote]
&lt;p&gt;What exactly &amp;quot;does not work&amp;quot;?&lt;/p&gt;
&lt;p&gt;In short my typical design is like this:&lt;/p&gt;
&lt;p&gt;- &amp;quot;sort&amp;quot; field in DB&lt;/p&gt;
&lt;p&gt;- up/down swaps the items in the underlying data&lt;/p&gt;
&lt;p&gt;&amp;nbsp; - then iterates on the list to renumber the sort value all items&lt;/p&gt;
&lt;p&gt;&amp;nbsp; - then write the data back to the DB&lt;/p&gt;
&lt;p&gt;To get started, a&amp;nbsp;good standalone example is this:&amp;nbsp;&lt;a href="https://docs.appian.com/suite/help/24.3/recipe-add-edit-and-remove-data-in-an-inline-editable-grid.html"&gt;https://docs.appian.com/suite/help/24.3/recipe-add-edit-and-remove-data-in-an-inline-editable-grid.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to save a row order in grid</title><link>https://community.appian.com/thread/140230?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 13:36:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6b6f6f00-3969-46c6-b1b1-6590829b4aac</guid><dc:creator>Kumar Agniwesh</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  /*  
  * local!employess is provided in this recipe as a way to start with hard-coded
  * data. However, this data is identical to the data created from the entity-backed
  * tutorial. Replace the hard-coded data with a query to the employee data store
  * entity and all of the employee records from the tutorial will appear.
  *
  * To replace this data with your own, replace (ctrl+H or cmd+H) all references to
  * local!employees with your data source, either via rule input or local variable.
  */
  local!tempEmployHolder,
  local!employees: {
    a!map(
      id: 1,
      firstName: &amp;quot;John&amp;quot;,
      lastName: &amp;quot;Smith&amp;quot;,
      department: &amp;quot;Engineering&amp;quot;,
      title: &amp;quot;Director&amp;quot;,
      phoneNumber: &amp;quot;555-123-4567&amp;quot;,
      startDate: today() - 360,
      sequence: 1
    ),
    a!map(
      id: 2,
      firstName: &amp;quot;Michael&amp;quot;,
      lastName: &amp;quot;Johnson&amp;quot;,
      department: &amp;quot;Finance&amp;quot;,
      title: &amp;quot;Analyst&amp;quot;,
      phoneNumber: &amp;quot;555-987-6543&amp;quot;,
      startDate: today() - 360,
      sequence: 2
    ),
    a!map(
      id: 3,
      firstName: &amp;quot;Mary&amp;quot;,
      lastName: &amp;quot;Reed&amp;quot;,
      department: &amp;quot;Engineering&amp;quot;,
      title: &amp;quot;Software Engineer&amp;quot;,
      phoneNumber: &amp;quot;555-456-0123&amp;quot;,
      startDate: today() - 240,
      sequence: 3
    ),

  },
  a!formLayout(
    label: &amp;quot;Example: Add,Update, or Remove Employee Data&amp;quot;,
    contents: {
      a!gridLayout(
        totalCount: count(local!employees),
        headerCells: {
          a!gridLayoutHeaderCell(label: &amp;quot;First Name&amp;quot;),
          a!gridLayoutHeaderCell(label: &amp;quot;Last Name&amp;quot;),
          a!gridLayoutHeaderCell(label: &amp;quot;Department&amp;quot;),
          a!gridLayoutHeaderCell(label: &amp;quot;Title&amp;quot;),
          a!gridLayoutHeaderCell(label: &amp;quot;Phone Number&amp;quot;),
          a!gridLayoutHeaderCell(label: &amp;quot;Start Date&amp;quot;, align: &amp;quot;RIGHT&amp;quot;),
          /* For the &amp;quot;Remove&amp;quot; column */
          a!gridLayoutHeaderCell(label: &amp;quot;&amp;quot;),
          a!gridLayoutHeaderCell(label: &amp;quot;&amp;quot;)
        },
        /* Only needed when some columns need to be narrow */
        columnConfigs: {
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 2),
          a!gridLayoutColumnConfig(width: &amp;quot;ICON&amp;quot;),
          a!gridLayoutColumnConfig(width: &amp;quot;ICON&amp;quot;)
        },
        /*
        * a!forEach() will take local!employee data and used that data to loop through an
        * expression that creates each row.
        *
        * When modifying the recipe to work with your data, you only need to change:
        * 1.) the number of fields in each row
        * 2.) the types of fields for each column (i.e. a!textField() for text data elements)
        * 3.) the fv!item elements. For example fv!item.firstName would change to fv!item.yourdata
        */
        rows: a!forEach(
          items: local!employees,
          expression: a!gridRowLayout(
            contents: {
              /* For the First Name Column*/
              a!textField(
                /* Labels are not visible in grid cells but are necessary to meet accessibility requirements */
                label: &amp;quot;first name &amp;quot; &amp;amp; fv!index,
                value: fv!item.firstName,
                saveInto: fv!item.firstName,
                required: true
              ),
              /* For the Last Name Column*/
              a!textField(
                label: &amp;quot;last name &amp;quot; &amp;amp; fv!index,
                value: fv!item.lastName,
                saveInto: fv!item.lastName,
                required: true
              ),
              /* For the Department Column*/
              a!dropdownField(
                label: &amp;quot;department &amp;quot; &amp;amp; fv!index,
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                choiceLabels: {
                  &amp;quot;Corporate&amp;quot;,
                  &amp;quot;Engineering&amp;quot;,
                  &amp;quot;Finance&amp;quot;,
                  &amp;quot;Human Resources&amp;quot;,
                  &amp;quot;Professional Services&amp;quot;,
                  &amp;quot;Sales&amp;quot;
                },
                choiceValues: {
                  &amp;quot;Corporate&amp;quot;,
                  &amp;quot;Engineering&amp;quot;,
                  &amp;quot;Finance&amp;quot;,
                  &amp;quot;Human Resources&amp;quot;,
                  &amp;quot;Professional Services&amp;quot;,
                  &amp;quot;Sales&amp;quot;
                },
                value: fv!item.department,
                saveInto: fv!item.department,
                required: true
              ),
              /* For the Title Column*/
              a!textField(
                label: &amp;quot;title &amp;quot; &amp;amp; fv!index,
                value: fv!item.title,
                saveInto: fv!item.title,
                required: true
              ),
              /* For the Phone Number Column*/
              a!textField(
                label: &amp;quot;phone number &amp;quot; &amp;amp; fv!index,
                placeholder: &amp;quot;555-456-7890&amp;quot;,
                value: fv!item.phoneNumber,
                saveInto: fv!item.phoneNumber
              ),
              /* For the Start Date Column*/
              a!dateField(
                label: &amp;quot;start date &amp;quot; &amp;amp; fv!index,
                value: fv!item.startDate,
                saveInto: fv!item.startDate,
                required: true,
                align: &amp;quot;RIGHT&amp;quot;
              ),
              /* For the Moving Column Up*/
              a!richTextDisplayField(
                value: a!richTextIcon(
                  icon: &amp;quot;arrow-circle-o-up&amp;quot;,
                  altText: &amp;quot;Move &amp;quot; &amp;amp; fv!index,
                  caption: &amp;quot;Move &amp;quot; &amp;amp; fv!item.firstName &amp;amp; &amp;quot; &amp;quot; &amp;amp; fv!item.lastName,
                  link: a!dynamicLink(
                    value: fv!index,
                    saveInto: {
                      local!employees[fv!index - 1].sequence,
                      a!save(
                        local!employees[fv!index].sequence,
                        fv!index - 1
                      ),
                      a!save(
                        local!tempEmployHolder,
                        index(local!employees, fv!index - 1, null())
                      ),
                      a!save(
                        local!employees,
                        a!update(
                          local!employees,
                          fv!index - 1,
                          index(local!employees, fv!index, null())
                        )
                      ),
                      a!save(
                        local!employees,
                        a!update(
                          local!employees,
                          fv!index,
                          local!tempEmployHolder
                        )
                      ),
                      a!save(local!tempEmployHolder, null())
                    }
                  ),
                  linkStyle: &amp;quot;STANDALONE&amp;quot;,
                  color: &amp;quot;NEGATIVE&amp;quot;,
                  showWhen: not(fv!isFirst)
                )
              ),
              a!richTextDisplayField(
                value: a!richTextIcon(
                  icon: &amp;quot;arrow-circle-down&amp;quot;,
                  altText: &amp;quot;Move &amp;quot; &amp;amp; fv!index,
                  caption: &amp;quot;Move &amp;quot; &amp;amp; fv!item.firstName &amp;amp; &amp;quot; &amp;quot; &amp;amp; fv!item.lastName,
                  link: a!dynamicLink(
                    value: fv!index,
                    saveInto: {
                      local!employees[fv!index + 1].sequence,
                      a!save(
                        local!employees[fv!index].sequence,
                        fv!index + 1
                      ),
                      a!save(
                        local!tempEmployHolder,
                        index(local!employees, fv!index + 1, null())
                      ),
                      a!save(
                        local!employees,
                        a!update(
                          local!employees,
                          fv!index + 1,
                          index(local!employees, fv!index, null())
                        )
                      ),
                      a!save(
                        local!employees,
                        a!update(
                          local!employees,
                          fv!index,
                          local!tempEmployHolder
                        )
                      ),
                      a!save(local!tempEmployHolder, null())
                    }
                  ),
                  linkStyle: &amp;quot;STANDALONE&amp;quot;,
                  color: &amp;quot;NEGATIVE&amp;quot;,
                  showWhen: not(fv!isLast)
                )
              )
            },
            id: fv!index
          )
        ),
        addRowlink: a!dynamicLink(
          label: &amp;quot;Add Employee&amp;quot;,
          /*
           * For your use case, set the value to a blank instance of your CDT using
           * the type constructor, e.g. type!Employee(). Only specify the field
           * if you want to give it a default value e.g. startDate: today()+1.
           */
          value: { startDate: today() + 1 },
          saveInto: {
            a!save(
              local!employees,
              append(local!employees, save!value)
            )
          }
        ),
        rowHeader: 1
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: a!buttonWidget(label: &amp;quot;Submit&amp;quot;, submit: true)
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>