<?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 Expressions as Expression Parameters</title><link>https://community.appian.com/discussions/f/rules/11195/passing-expressions-as-expression-parameters</link><description>Are there any plans to allow for the passing expressions as expression parameters? I think this would be an incredibly useful feature to add to the expression language.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Passing Expressions as Expression Parameters</title><link>https://community.appian.com/thread/49138?ContentTypeID=1</link><pubDate>Thu, 05 Oct 2017 16:16:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:42c1adaf-7e6e-4ac0-a1ad-2a559f6f2c80</guid><dc:creator>Philip Snyman</dc:creator><description>Yes! Thank you for your efforts! Much appreciated! I think this is really a great feature...&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passing Expressions as Expression Parameters</title><link>https://community.appian.com/thread/49135?ContentTypeID=1</link><pubDate>Thu, 05 Oct 2017 15:56:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:13693206-e2a0-4af6-9cac-f23bdef49b08</guid><dc:creator>gianninol</dc:creator><description>Ah, it looks like you figured it out on your own!&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passing Expressions as Expression Parameters</title><link>https://community.appian.com/thread/49134?ContentTypeID=1</link><pubDate>Thu, 05 Oct 2017 15:54:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8792d3c5-f8c3-478f-996f-8976a3cb198e</guid><dc:creator>gianninol</dc:creator><description>&lt;p&gt;You can pass expression rule references via Any Type parameters. For instance,&amp;nbsp;in the below example, we control the transformation function that is used to change a local variable when a button is clicked. When the first button is pressed, the value will have the logarithm with base 5 taken. When the first button is pressed, the value with be taken to the 5th power. This works with any expression rule in addition to functions.&lt;/p&gt;
&lt;p&gt;Make a button widget rule called myButtonWidget with inputs ri!value and ri!transformFunction with the following code:&lt;/p&gt;
&lt;p&gt;a!buttonWidget(&lt;/p&gt;
&lt;p&gt;&amp;nbsp;label: &amp;quot;Transform Value&amp;quot;,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;saveInto: a!save(ri!value, ri!transformRule(ri!value))&lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;
&lt;p&gt;Then, in an interface, call this rule twice with different transformation functions:&lt;/p&gt;
&lt;p&gt;load(&lt;/p&gt;
&lt;p&gt;&amp;nbsp; local!value: 10,&lt;/p&gt;
&lt;p&gt;a!buttonLayout(&lt;/p&gt;
&lt;p&gt;&amp;nbsp;primaryButtons: {&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;rule!myButtonWidget(local!value, log(_, 5)),&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;rule!myButtonWidget(local!value, power(_, 5))&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passing Expressions as Expression Parameters</title><link>https://community.appian.com/thread/49132?ContentTypeID=1</link><pubDate>Thu, 05 Oct 2017 15:48:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f4934995-80a7-4c46-bf3c-1aacc305f464</guid><dc:creator>Philip Snyman</dc:creator><description>&lt;p&gt;Thank you. Yes, I am familiar with what you describe above. I am however referring to the passing of an expression rule as an argument ( rule input ) to another expression rule; not passing the result of an expression rule to another expression rule.&lt;/p&gt;
&lt;p&gt;I have experimented and I believe I have answered my own question. Here is an&amp;nbsp;explanation if you&amp;#39;re interested. It relates to the scenario of another thread we have been discussing (&amp;nbsp;&lt;a href="/discussions/f/general/11194/accessing-cdt-field-properties"&gt;https://community.appian.com/discussions/f/general/11194/accessing-cdt-field-properties&lt;/a&gt;&amp;nbsp;). So, I have a reusable interface expression that accepts AnyType of rule input where the inputs can be different CDTs. These CDTs do however have common field names, i.e. name, description. I want to pass a CDT specific validation ( expression rule ) as a rule into the interface expression that checks if the value entered for the name field already exists in the database, i.e. through the use of a!queryEntity. This would of course be different for each CDT. So, for example, I would have two expression rules named&amp;nbsp;&lt;em&gt;isCustomerNameUnique(name)&lt;/em&gt; and&amp;nbsp;&lt;em&gt;isProductNameUnique(name)&lt;/em&gt;. Each of them would check if the name is unique and then return either&amp;nbsp;&lt;em&gt;null&lt;/em&gt; if it unique or a validation message indicating the the name is not unique, i.e. &amp;quot;The customer name already exists.&amp;quot; or &amp;quot;The product name already exists.&amp;quot;. The interface expression would then accept a rule input of AnyType called validation as well as a rule input of AnyType called entity. I could then invoke that expression&amp;nbsp;when I need to validate user input. For example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!textField(
  label: &amp;quot;Name&amp;quot;,
  value: ri!entity.name,
  saveInto: ri!entity.name,
  validations: ri!validation(ri!entity.name)
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Works! Thanks for getting me to think through this carefully! The answer came to me when I explored the concepts detailed here :&amp;nbsp;&lt;a href="https://docs.appian.com/suite/help/17.3/Expressions.html#passing-functions-rules-and-data-types-as-arguments"&gt;https://docs.appian.com/suite/help/17.3/Expressions.html#passing-functions-rules-and-data-types-as-arguments&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What do you think?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passing Expressions as Expression Parameters</title><link>https://community.appian.com/thread/49130?ContentTypeID=1</link><pubDate>Thu, 05 Oct 2017 14:59:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a0799168-3360-4f16-a117-e23dcce8af06</guid><dc:creator>Colton Beck</dc:creator><description>&lt;p&gt;You can take a look at the general expression documentation &lt;a href="https://docs.appian.com/suite/help/17.3/Expressions.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can play around with this in the expression editor. For example, you can create a rule called rule!getDateByDateTime which takes in a datetime parameter. Instead of directly passing a datetime, you can pass another rule like rule!getDatetimeByDateAndTime, which will take date and time parameters.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can put these together like this: rule!getDateByDateTime(rule!getDatetimeByDateAndTime(ri!date, ri!time))&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let me know if you have any other questions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passing Expressions as Expression Parameters</title><link>https://community.appian.com/thread/49129?ContentTypeID=1</link><pubDate>Thu, 05 Oct 2017 14:47:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:71c2dfe6-6986-49ed-9a45-45aa652873ae</guid><dc:creator>Philip Snyman</dc:creator><description>&lt;p&gt;It could be the same thing. Can you provide me with the link to where this is described? Otherwise, if you can demonstrate the syntax that should suffice. Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passing Expressions as Expression Parameters</title><link>https://community.appian.com/thread/49127?ContentTypeID=1</link><pubDate>Thu, 05 Oct 2017 14:31:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0ba14eb8-5b6e-4850-b8a3-fb6aa7df64e5</guid><dc:creator>Colton Beck</dc:creator><description>You can pass expressions as rule inputs to other expressions. Are you asking for something different from this?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>