<?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>To save with variable in save() function</title><link>https://community.appian.com/discussions/f/user-interface/13062/to-save-with-variable-in-save-function</link><description>Hi, 
 
 I want to save one variable which i created in with and values of that variable are getting update on basis of drop down. 
 I am using that variable(dataset) further to display something. But when i am trying to save any value in that dataset</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58871?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 16:04:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:573d4f73-6bdd-4d4b-8503-4a81d74f94a5</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Also, just as a suggestion, where you do this:&lt;/p&gt;
&lt;pre&gt;saveInto: {&lt;br /&gt;  ri!masterDataSet[ri!index].nameCopy,&lt;br /&gt;  a!save(&lt;br /&gt;    ri!masterDataSet[ri!index].nameCopy,&lt;br /&gt;    upper(&lt;br /&gt;      ri!masterDataSet[ri!index].nameCopy&lt;br /&gt;    )&lt;br /&gt;  )&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;You could replace this with simply:&lt;/p&gt;
&lt;pre&gt;saveInto: {&lt;br /&gt;&amp;nbsp; a!save(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ri!masterDataSet[ri!index].nameCopy,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; upper(save!value)&lt;br /&gt;&amp;nbsp; )&lt;br /&gt;}&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58870?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 16:00:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:adaf9315-ad60-4f72-b11f-901eeba2476e</guid><dc:creator>Mike Schmitt</dc:creator><description>I&amp;#39;m not clear what exactly you&amp;#39;re trying to do - can you start out by explaining your use case at a more high level?&lt;br /&gt;
&lt;br /&gt;
It looks like you&amp;#39;re trying to directly edit a data set, and in that case the usual method is to query the original data in-process, and pass it into your SAIL form via a rule input (ri!) variable.  Your editable grid is then free to save changed values into the ri! variable, which in this case acts similar to a load() variable.  You would then save any changes back to the database in your process model after the form is submitted.&lt;br /&gt;
&lt;br /&gt;
(Also: in the case where your reply accidentally gets submitted multiple times, you can click the &amp;quot;More&amp;quot; link under the comment body and &amp;quot;Delete&amp;quot; on the extra copies.)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58867?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 15:19:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:51083203-b921-4535-89d0-236bb08f9b4a</guid><dc:creator>sauravk</dc:creator><description>Then in my case how will i achieve my goal.&lt;br /&gt;
 I need to compare data dynamically. I mean first time if i select anything in with than i am preparing this dataset which i am passing to another rule under grid layout(Under new with) where i am comparing two field values , but my validation is working with existing values in dataset, but when i enter new value in both fields which is not available in that dataset, than i am getting this error as i am trying to save this value in this dataset.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58866?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 15:19:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:94221511-3e8c-4126-ad52-7ea50688a2ac</guid><dc:creator>sauravk</dc:creator><description>Then in my case how will i achieve my goal.&lt;br /&gt;
 I need to compare data dynamically. I mean first time if i select anything in with than i am preparing this dataset which i am passing to another rule under grid layout(Under new with) where i am comparing two field values , but my validation is working with existing values in dataset, but when i enter new value in both fields which is not available in that dataset, than i am getting this error as i am trying to save this value in this dataset.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58865?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 15:19:43 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4a491d97-cabd-497c-a84c-5f159e25a8dd</guid><dc:creator>sauravk</dc:creator><description>Then in my case how will i achieve my goal.&lt;br /&gt;
 I need to compare data dynamically. I mean first time if i select anything in with than i am preparing this dataset which i am passing to another rule under grid layout(Under new with) where i am comparing two field values , but my validation is working with existing values in dataset, but when i enter new value in both fields which is not available in that dataset, than i am getting this error as i am trying to save this value in this dataset.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58857?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 14:37:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2a67ffaa-c506-49b9-a064-4c6e681a290c</guid><dc:creator>Mike Schmitt</dc:creator><description>I&amp;#39;m a little unclear still what you&amp;#39;re trying to accomplish, but with() variables are NOT meant to be saved into directly - they are meant only to automatically evaluate based on changes (if applicable) in the data in their original definitions.  Hence why you&amp;#39;re getting the error message which is expected.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58854?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 14:09:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0cfd8a55-e7e0-48b0-b2f6-3876e1857f7b</guid><dc:creator>sauravk</dc:creator><description>No it will not work.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58852?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 14:04:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:32af4bdd-4008-4f89-bcfa-3c77a2abfa05</guid><dc:creator>santhosh Kumar</dc:creator><description>Not sure exactly what is your requirement but if you want to save within with() either it should be a load() variable or use a rule input and pass it to the main interface and map that rule input to the Process Model as PV. This way you can save a variable within with() other than using load variable.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58850?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 13:50:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ab07dc55-ecac-4f9c-af7a-ad03a556f70a</guid><dc:creator>Dylan Salopek</dc:creator><description>&lt;p&gt;It will be able to update with dynamic values. **Edit: It will update if the queryEntity is placed in a saveInto; alternatively you could also use a button that is used to for requerying data**&lt;/p&gt;
&lt;p&gt;One approach you could take is 1) change masterDataSet to load(), 2) when you update the variables that drive the query entity in their saveIntos, requery the entity as well (if you are constantly updating the parameters of the qe, the amount of database transactions can be risky and depending on the size of the data being queried, can provide a bad user-experience). If you query the entity once, this may be the easiest way to achieve your goal. Below is an example of what I mean:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;load(
  local!datasubset,
  local!input1,
  local!input2,
  a!sectionLayout(
    contents: {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!textField(
                label: &amp;quot;Input 1&amp;quot;,
                value: local!input1,
                saveInto: local!input1
              ),
              a!textField(
                label: &amp;quot;Input 2&amp;quot;,
                value: local!input2,
                saveInto: local!input2
              ),
              a!buttonLayout(
                primaryButtons: a!buttonWidget(
                  label: &amp;quot;Search&amp;quot;,
                  saveInto: {
                    a!save(
                      local!datasubset,
                      rule!queryEntity(
                        local!input1,
                        local!input2
                      )
                    )
                  }
                )
              )
            }
          )
        }
      )
    }
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You can also copy the value of the masterDataSet value into a load variable, and make any changes to that variable&amp;#39;s value. Then, you would run validations on the load variable that you define.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58848?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 13:27:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e7f2426e-b8db-43bf-9e26-f8716a1e0218</guid><dc:creator>sauravk</dc:creator><description>I am setting masterDataset through quertEntity but input of Q.E is dynamic. That&amp;#39;s why i putting this in with otherwise masterDataSet will not be able to update dynamically.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58845?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 13:10:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3814dc87-802f-42cc-8b58-0cdba3a9f4d3</guid><dc:creator>Dylan Salopek</dc:creator><description>How is the value of masterDataSet set? A query entity, editable grid? Again, is there a specific reason you are using a with() variable instead of a load()?&lt;br /&gt;
&lt;br /&gt;
If there is no reason to use a with() variable, then it may make sense to change it to a load(). Otherwise, you can create a new load() datasubset from the value in the with() variable in the SAIL you posted and append data to that variable.&lt;br /&gt;
&lt;br /&gt;
If possible though,check the impact of changing masterDataSet to a load() as that may be a much simpler path to take.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58844?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 12:57:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d308a247-f808-4aa5-8cf8-0700bf2e6798</guid><dc:creator>sauravk</dc:creator><description>Just to add here. This code i am calling from another rule inside with only. Where masterDataSet is getting prepare inside with .&lt;br /&gt;
On my validation whenever i compare with existing values of masterDataSet than it will work fine. But when i try to give same new value which is not part of masterDataSet than validation rule is not working. So i tried to save updated value in this code. But as variable is defined in with in another rule and i am passing here.&lt;br /&gt;
&lt;br /&gt;
I hope i explained everything.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58841?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 12:54:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9e5c3121-5384-4056-a687-35ec8667bf4b</guid><dc:creator>sauravk</dc:creator><description>posted&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58840?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 12:54:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f562c976-0f20-42f0-8760-6cd6bdaea7fb</guid><dc:creator>sauravk</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;load(
  
  with(
    
      a!gridRowLayout(
        id: ri!index,
        contents: {
          
          a!textField(
            label: &amp;quot;Hello&amp;quot; &amp;amp; ri!index,
            value: ri!masterDataSet[ri!index].name,
            saveInto: {
              ri!masterDataSet[ri!index].name,
              a!save(
                ri!masterDataSet[ri!index].name,
                upper(
                  ri!masterDataSet[ri!index].name
                )
              )
              /*a!save(*/
            /*ri!testDataSet.name,*/
            /*save!value*/
            /*)*/
              
            },
            
            validations: {
                 if(
                contains(
                  touniformstring(
                    a!flatten(
                      {
                        remove(
                          ri!testDataSet.name,
                          wherecontains(ri!masterDataSet[ri!index].id,ri!testDataSet.id)
                        ),
                        ri!testDataSet.name,
                        ri!testDataSet.nameCopy
                      }
                    )
                  ),
                  tostring(
                    ri!masterDataSet[ri!index].name
                  )
                ),
                &amp;quot;This value already exists in the data&amp;quot;,
                &amp;quot;&amp;quot;
              )
            }
          )
          ,
		            a!textField(
            label: &amp;quot;Hii&amp;quot; &amp;amp; ri!index,
            value: ri!masterDataSet[ri!index].nameCopy,
            saveInto: {
              ri!masterDataSet[ri!index].nameCopy,
              a!save(
                ri!masterDataSet[ri!index].nameCopy,
                upper(
                  ri!masterDataSet[ri!index].nameCopy
                )
              )
              /*a!save(*/
            /*ri!testDataSet.name,*/
            /*save!value*/
            /*)*/
              
            },
            
            validations: {
                 if(
                contains(
                  touniformstring(
                    a!flatten(
                      {
                        remove(
                          ri!testDataSet.nameCopy,
                          wherecontains(ri!masterDataSet[ri!index].id,ri!testDataSet.id)
                        ),
                        ri!testDataSet.name,
                        ri!testDataSet.nameCopy
                      }
                    )
                  ),
                  tostring(
                    ri!masterDataSet[ri!index].nameCopy
                  )
                ),
                &amp;quot;This value already exists in the data&amp;quot;,
                &amp;quot;&amp;quot;
              )
            }
          )
          &lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58839?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 12:46:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9e9744ef-0ef1-4514-8458-0313754d2396</guid><dc:creator>Dylan Salopek</dc:creator><description>Is there a reason to not use load()? &lt;br /&gt;
&lt;br /&gt;
If you uses a load() variable and save into it, you will be able to display the resulting value.&lt;br /&gt;
&lt;br /&gt;
You can also declare a with() variable that is built off of the values of the load() variables that will update whenever a load() variable is saved into. &lt;br /&gt;
&lt;br /&gt;
Do you mind posting details of your rules? This will help identify the best solution going forward.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: To save with variable in save() function</title><link>https://community.appian.com/thread/58835?ContentTypeID=1</link><pubDate>Tue, 07 Aug 2018 12:30:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:08933440-74b3-41d8-9295-c4c841cf3fa7</guid><dc:creator>sravanis918</dc:creator><description>Hi sauravk,&lt;br /&gt;
&lt;br /&gt;
Can you please share your code snippet for better understanding of requirement?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>