<?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>Passing data to a CDT from a editable grid</title><link>https://community.appian.com/discussions/f/data/18723/passing-data-to-a-cdt-from-a-editable-grid</link><description>Hello! 
 I am working on an interface which shows a editable grid. The grid gets data from a expression rule , which I pass to interface using a local variable. 
 Now I want to save the values showed in the grid to the CDT (rule input), but save function</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Passing data to a CDT from a editable grid</title><link>https://community.appian.com/thread/73702?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2020 07:50:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:017a406f-4fbd-4366-8e9e-ed1f81db5970</guid><dc:creator>Kiara Shakaj</dc:creator><description>&lt;p&gt;Yes the local!user is just a list of string value. And your solution works . Thank you very much&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passing data to a CDT from a editable grid</title><link>https://community.appian.com/thread/73695?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2020 02:51:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:12e785da-f6b0-4c9f-8b54-49f35568f2a3</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;So I&amp;#39;m a little unclear whether &lt;em&gt;&lt;strong&gt;local!user&lt;/strong&gt;&lt;/em&gt; is intended to be a CDT similar to ri!user, or if it&amp;#39;s just a list of usernames (i.e. text).&amp;nbsp; So for now I&amp;#39;m assuming it&amp;#39;s only a list of usernames, based on the &lt;em&gt;value:&lt;/em&gt; parameter of the text field in the grid row.&lt;/p&gt;
&lt;p&gt;I assume you&amp;#39;re just trying to give the user a chance to enter any edits to a user in the grid, then save the result (with any changes) into the ri!users CDT, where the usernames are stored in the &amp;quot;.username&amp;quot; property of the CDT.&amp;nbsp; This save will occur during the button click, by looping over &lt;em&gt;local!user&lt;/em&gt; and creating a dictionary for each item, and saving all of that into ri!users.&amp;nbsp; I&amp;#39;m not sure why you have a &amp;quot;selectionSaveInto&amp;quot;, that doesn&amp;#39;t appear needed so I&amp;#39;ve commented it out.&lt;/p&gt;
&lt;p&gt;Please see the example below, and note that I&amp;#39;ve removed a few irrelevant sections of the form - the only relevant changes are to the grid and to the submit button.&amp;nbsp; Though I&amp;#39;ve also cleaned up the formatting some.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!user: rule!MV_readCSVcontent(
    if(
      isnull(ri!day),
      today() - 1,
      ri!day
    )
  ),
  local!exportDocId,
  local!errorMessage,
 
  { 
    /* section removed from example, no changes should be needed */
    
    a!gridLayout(
      label: &amp;quot;grid&amp;quot;,
      labelPosition: &amp;quot;COLLAPSED&amp;quot;,
      headerCells: {
        a!gridLayoutHeaderCell(label: &amp;quot;Username&amp;quot;)
      },
      columnConfigs: {
        a!gridLayoutColumnConfig(
          width: &amp;quot;DISTRIBUTE&amp;quot;
        )
       
      },
      rows: {
        a!forEach(
          items: local!user,
          expression: {
            a!gridRowLayout(
              id: fv!index,
              contents: {
                a!textField(
                  label: &amp;quot;Username&amp;quot;,
                  value: fv!item,
                  saveInto: {
                    fv!item
                    /* a!save( */
                      /* ri!users.username, */
                      /* fv!item */
                    /* ) */
                  }
                )
              }
            )
          }
        )
      },
      /* selectionSaveInto:  a!forEach( */
        /* items: local!user, */
        /* expression: a!save(ri!users, local!user) */
      /* ), */
      
      showwhen: if(
        isnull(ri!day),
        false(),
        true()
      ),
      validations: {},
      shadeAlternateRows: true,
      
    ),
    
    /* link field removed from example, no changes should be needed */
    
    a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: &amp;quot;Submit&amp;quot;,
          saveInto: {
            a!save(
              ri!users,
              a!forEach(
                local!users,
                {
                  username: fv!item
                }
              )
            )
          },
          submit: true,
          style: &amp;quot;PRIMARY&amp;quot;
        )
      }
    ),
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>