<?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>set the value of a process variable in an expression</title><link>https://community.appian.com/discussions/f/process/20319/set-the-value-of-a-process-variable-in-an-expression</link><description>Hello community, 
 is it possible to set/change the value of a process variable in a scripttask/expression for example when a condition is true other than node output is stored as. 
 I know how to set a value of a processvariable in the node output, but</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: set the value of a process variable in an expression</title><link>https://community.appian.com/thread/79441?ContentTypeID=1</link><pubDate>Tue, 09 Feb 2021 14:59:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:aedfd676-7246-4998-a9e8-e0f142db48fd</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Ah i see.&amp;nbsp; No, the way you&amp;#39;ve done it is the correct way.&amp;nbsp; I&amp;#39;ve wished at times for the ability to update multiple PVs based on one expression (such as an expression that runs an expensive calculation, and i want to just run it once and save various aspects of the result to different PVs).&amp;nbsp; The only real alternative here is to run the expensive operation in an input variable (which sucks since input variable expressions &lt;em&gt;&lt;strong&gt;STILL&lt;/strong&gt;&lt;/em&gt; collapse the expression code they contain down to one line, upon saving...), then refer to that ACP in the different output expressions.&amp;nbsp; But even this still does require one output entry added for each PV you want to write into.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: set the value of a process variable in an expression</title><link>https://community.appian.com/thread/79427?ContentTypeID=1</link><pubDate>Tue, 09 Feb 2021 09:13:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:be90a1ae-6fa6-43d0-9d07-bb3737926d01</guid><dc:creator>erikb0001</dc:creator><description>&lt;p&gt;Hello Mike,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What I am trying to accomplish is to set the value of multiple pv&amp;#39;s based on the value of 1 other pv. Then the values of the multiple pv&amp;#39;s will be used/configured in the doc from template service.&amp;nbsp;&lt;br /&gt;No I configured one expression for each pv separately in the nodeouput of a scriptask to save the value. So wanted to know if it is possible to update all the pv&amp;#39;s in one expression.&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Erik&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: set the value of a process variable in an expression</title><link>https://community.appian.com/thread/79390?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2021 15:00:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c2246c4a-5dc8-412d-ab78-927ac242f001</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Can you give a bit more clarification as to what you&amp;#39;re trying to accomplish, then?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: set the value of a process variable in an expression</title><link>https://community.appian.com/thread/79384?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2021 07:20:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b5bffdd0-f059-4ce0-841a-00e943b5cba0</guid><dc:creator>erikb0001</dc:creator><description>&lt;p&gt;Thank you Mike.&lt;br /&gt;I wanted to know if it was possible not use the node outputs to make it more dynamic.&lt;br /&gt;The Apple and colors was an example to illustrate my question.&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: set the value of a process variable in an expression</title><link>https://community.appian.com/thread/79278?ContentTypeID=1</link><pubDate>Sun, 31 Jan 2021 17:46:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:196c0bce-385c-47bb-87f5-4c4a61b719e7</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I guess it depends on what exactly you want to do.&amp;nbsp; If you want to set the value of pv!color to &amp;quot;green&amp;quot; when fruit is &amp;quot;apple&amp;quot;, but otherwise not change the value of pv!color, you would simply set the following expression in your script task to save into pv!color:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;if(
  pv!fruit = &amp;quot;Apple&amp;quot;,
  &amp;quot;green&amp;quot;,
  pv!color
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: set the value of a process variable in an expression</title><link>https://community.appian.com/thread/79276?ContentTypeID=1</link><pubDate>Sun, 31 Jan 2021 13:46:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e299c76c-f85c-4ec8-a707-d726394c6251</guid><dc:creator>erikb0001</dc:creator><description>&lt;p&gt;Hi Chris,&lt;/p&gt;
&lt;p&gt;Thanks for you answer.&lt;br /&gt;Now I know that there is no other way, I will use the node outputs in a scripttask to set the variables based on the expression with the condition.&lt;/p&gt;
&lt;p&gt;Kind Regards.&lt;/p&gt;
&lt;p&gt;Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: set the value of a process variable in an expression</title><link>https://community.appian.com/thread/79272?ContentTypeID=1</link><pubDate>Sat, 30 Jan 2021 15:52:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f2519d93-2e06-4e78-b2e3-8bdfed9767e0</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;No, you cannot achieve this as in your code posted above - process variables will be updated on the data tab, node input or outputs.&amp;nbsp; What is your use case / where are you attempting to run this expression?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>