<?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>Conditional saving on buttons</title><link>https://community.appian.com/discussions/f/new-to-appian/18715/conditional-saving-on-buttons</link><description>Is it OK to use this approach for conditional multiple rule input saving on button component? 
 
 
 This is from milestone template which uses the same button on most steps and I need to do specific actions depending on which step I&amp;#39;m on. 
 To me, it</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Conditional saving on buttons</title><link>https://community.appian.com/thread/73678?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 13:25:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:016da673-9e3b-48fa-8ecf-faf04f2f6544</guid><dc:creator>ivanm0004</dc:creator><description>&lt;p&gt;Thank you, guys! It is a true joy to learn Appian with such a great community! :)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Conditional saving on buttons</title><link>https://community.appian.com/thread/73677?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 13:23:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fcb87d51-f432-44d9-ae16-b671677b62f9</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;One other thing I spotted is what looks like 2 if()&amp;#39;s that have the same condition.&amp;nbsp; You could just make 1 if() that returns an array of those two outputs on the same &amp;quot;true&amp;quot; condition.&lt;/p&gt;
&lt;p&gt;The standard is the empty set {} as the &amp;#39;false&amp;#39; condition for most if()s I&amp;#39;ve seen.&amp;nbsp; When the output is strings, it&amp;#39;s often &amp;quot;&amp;quot; the empty string.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Conditional saving on buttons</title><link>https://community.appian.com/thread/73675?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 13:10:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4f79bb02-f2d9-4c7e-87d2-36a71f038e18</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;This looks correct, though I think there&amp;#39;s a chance you might have issues unless you replace &amp;quot;null&amp;quot; with an empty set &lt;em&gt;&lt;strong&gt;{}&lt;/strong&gt;&lt;/em&gt; for the non a!save portion of the if statement.&amp;nbsp; &amp;quot;saveInto&amp;quot; requires a list of saves, and items in the list that return an empty set are safely ignored, but items in the list that return &amp;quot;null&amp;quot; will show up as an entry in the list, which Appian may or may not handle properly right now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Conditional saving on buttons</title><link>https://community.appian.com/thread/73674?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 13:06:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2bd15734-07d5-42ad-bcb6-6b55fcd0f566</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;Nope, you&amp;#39;re following the paradigm perfectly.&lt;/p&gt;
&lt;p&gt;The saveInto parameter takes an array of targets or a!save() function calls.&amp;nbsp; All your if()&amp;#39;s do is return either an a!save() or a null.&amp;nbsp; If saveInto ignores the nulls, you can just act like your if&amp;#39;s just return a!saves.&amp;nbsp; So your list of if()&amp;#39;s just becomes a list of a!save(), exactly what saveInto wants.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Nothing in the whole language cares how you arrive at the&amp;nbsp;data as long as it&amp;#39;s the type that it&amp;#39;s looking for.&amp;nbsp; It just abstracts all function calls to be nothing more than whatever their output is.&amp;nbsp; You have a function whose output is an a!save(); that&amp;#39;s good enough for saveInto().&amp;nbsp; It does not matter what it is.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But also,&amp;nbsp;there is essentially no place in the whole language where you could not use if(), and essentially no place where you should not.&amp;nbsp; It&amp;#39;s for everywhere, but so is almost everything else.&amp;nbsp; You could use a!forEach() to generate your list of a!save()&amp;#39;s there too.&amp;nbsp; I think I have before.&amp;nbsp; Or the apply() function, though that might as well be deprecated, or a helper rule, or the reduce() function, or a host of other things.&amp;nbsp; The only condition is the output of whatever it is happens to be a!save()s.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s no coincidence.&amp;nbsp; You have reached a higher level of understanding of how to use the expression language.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>