<?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>Need to edit data in 2 tables using editable grid</title><link>https://community.appian.com/discussions/f/general/20007/need-to-edit-data-in-2-tables-using-editable-grid</link><description>Hi all, 
 I am working on editable grid where I am adding invoice items for students training. I have two tables which are Invoice_Details and Student_Training_Details. When I am adding the Invoice_Details in the editable grid, I also need to enter the</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Need to edit data in 2 tables using editable grid</title><link>https://community.appian.com/thread/78243?ContentTypeID=1</link><pubDate>Tue, 01 Dec 2020 14:40:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:819176a0-b47e-4eed-a7ee-29431a0db758</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;My personal preference when having data that should apply to multiple tables is to set up the data so that it gets saved on clicking your submit button. You can be confident that the data is in the correct state on button click, so it&amp;#39;s easy to then save any data to the appropriate fields at that point.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s an example - I&amp;#39;m assuming in this case that the &amp;quot;Student_Training_Details&amp;quot; is a very simple CDT, with just an ID, FK_STUDENT_ID, and TRAINING_COMPLETED_DATE. Then, I&amp;#39;m running a forEach across each item in the &amp;quot;Invoice_Details&amp;quot; to create a new item of the &amp;quot;Student_Training_Details&amp;quot; for each row in the &amp;quot;Invoice_Details&amp;quot;. Here&amp;#39;s a sample expression for the button click:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!buttonWidget(
  label: &amp;quot;Submit&amp;quot;,
  submit: true,
  style: &amp;quot;PRIMARY&amp;quot;,
  saveInto: a!save(
    target: ri!studentTrainingDetails,
    value: a!forEach(
      items: ri!invoiceDetails,
      expression: type!TYPE_InvoiceDetails(
        studentId: fv!item.studentId,
        trainingCompletedDate: fv!item.trainingCompletedDate
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to edit data in 2 tables using editable grid</title><link>https://community.appian.com/thread/78238?ContentTypeID=1</link><pubDate>Tue, 01 Dec 2020 11:19:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c3194661-e357-4bd2-8a03-fc849eabebfe</guid><dc:creator>Richard Michaelis</dc:creator><description>&lt;p&gt;hi,&lt;/p&gt;
&lt;p&gt;you can create a some variables:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ri!studentsTrainingDetails&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;- here you can load alldetails which are relevant for your invoicing. you can do this in your form or in process script task in advance&amp;nbsp;&lt;/p&gt;
&lt;p&gt;you can load them by creating a queryEntity with a entityFilter&amp;nbsp;and search for your&amp;nbsp;&lt;span&gt;FK_STUDENT_ID&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Then if you have your editibale grid, you update your student_Trianing_details by an a!save().&lt;/p&gt;
&lt;p&gt;But the exact approach depends stongly on your CDT and form structue.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;possible solution&lt;br /&gt;: &lt;span&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;a!datefield(
    label: &amp;quot;Training completed at&amp;quot;,
    value: ri!Invoice_Detail.Training_Completed_Date,
    saveInto:{
        a!save(
            target:ri!Invoice_Detail.Training_Completed_Date,
            value:save!value
        ),
        a!save(
            target:ri!Student_Training_Details.Training_Completed_Date,
            value:ri!Invoice_Detail
        )

    }
)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>