<?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>Generate Appian Function From Text</title><link>https://community.appian.com/discussions/f/general/21110/generate-appian-function-from-text</link><description>Hello, 
 I have a use case where end users must be able to define &amp;quot;functions&amp;quot; that will be applied to values defined in the application. 
 I was wondering if it was possible for the end users to write an Appian function with SAIL format in a paragraphField</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Generate Appian Function From Text</title><link>https://community.appian.com/thread/82322?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 19:01:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:53a7ce86-bfff-407e-b5bd-45ab770f61f9</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;He&amp;#39;s speaking of the undocumented feature I call the evil function (not how it&amp;#39;s spelled but how it should be pronounced).&amp;nbsp; It takes text, treats it like code, and runs it.&amp;nbsp; All languages that support their version of the evil function suggest avoiding its use wherever possible, and I couldn&amp;#39;t agree more. A user could literally write ANYTHING and it would run, such as making themselves into Admins or any number of other horrible things they could do.&lt;/p&gt;
&lt;p&gt;Now, to your particular quandary.&amp;nbsp; It all depends on what you want to do.&amp;nbsp; If you want your functions to be far too complex, it might have to be a submission form that can be sent to developers to check and implement.&amp;nbsp; If you want instant feedback, you may need to have users select from a limited set of building blocks and see what you can arrange in the code.&lt;/p&gt;
&lt;p&gt;It might be possible to string together 5 or 6 simple mathematical operations, or some text operations, but the more diverse the harder it will naturally be to implement.&amp;nbsp; Have your clients provided an example of the kind of function they&amp;#39;d like the user to be able to make?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generate Appian Function From Text</title><link>https://community.appian.com/thread/82320?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 17:15:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2678df60-8592-4b0e-85ea-d0e078bd9014</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="59361" url="~/discussions/f/general/21110/generate-appian-function-from-text/82314#82314"]Mike! Shame on you ![/quote]
&lt;p&gt;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f625.svg" title="Disappointed relieved"&gt;&amp;#x1f625;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generate Appian Function From Text</title><link>https://community.appian.com/thread/82314?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 15:27:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d62ceef9-ebe6-4639-bee0-83869cf3ce80</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Mike! Shame on you !&lt;/p&gt;
&lt;p&gt;The solution I built works like this&lt;/p&gt;
&lt;p&gt;Iterate on all fields of a CDT. For each field look for formulas (Simple operations like +, -, * /, etc) stored in DB. Evaluate each formula (e.g. if there is a &amp;quot;+&amp;quot; in DB add a static value). Then sum up all the results.&lt;/p&gt;
&lt;p&gt;A UI allows users to configure these &amp;quot;formulas&amp;quot;. Example: If the value in the field &amp;quot;value&amp;quot; is between 5 and 10, then add 42 to the final result. I added weighting to make some fields more important than others.&lt;/p&gt;
&lt;p&gt;Does that make sense?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generate Appian Function From Text</title><link>https://community.appian.com/thread/82313?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 14:28:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f63a05f5-c112-4c49-81de-d67bf5ad924b</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I can&amp;#39;t speak for Stefan but the impression I got was that he was suggesting something close to a palette of available calculations on a particular field or set of fields, where you allow a user to fill in one or more values then choose an operator (i.e. from a dropdown), and then use a bit of kludgey / manual logic either in a DB view or, in my opinion, the same could be done directly on-form in Appian, to display the result to the user.&amp;nbsp; Of course this all depends on the desired operations being relatively uncomplicated, unless you want to sink loads and loads of time into developing it.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure how much this matches your use case, honestly - it sounds almost as if you&amp;#39;ve been tasked to build a SAIL parser within SAIL.&amp;nbsp; Such a thing is... certainly possible... but labor intensive, to the point that I&amp;#39;d be very hesitant.&amp;nbsp; A shortcut (undocumented function) which everyone will tell you to avoid at all costs at least in a production system, but which you could test out at least for a proof of concept, can be read about &lt;a href="/discussions/f/rules/4246/is-there-a-way-to-convert-a-string-to-evaluable-sail-expression-i/15169#15169"&gt;here&lt;/a&gt;.&amp;nbsp; I won&amp;#39;t name it because I don&amp;#39;t wanna get yelled at &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f61f.svg" title="Worried"&gt;&amp;#x1f61f;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generate Appian Function From Text</title><link>https://community.appian.com/thread/82312?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 14:13:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:11136ace-9e08-4fd5-9a98-b03acf98f25c</guid><dc:creator>Claire</dc:creator><description>&lt;p&gt;I understand your point.&amp;nbsp;&lt;br /&gt;I&amp;#39;m not sure to understand correctly your solution though : is the table storing formula with corresponding evaluated values ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generate Appian Function From Text</title><link>https://community.appian.com/thread/82266?ContentTypeID=1</link><pubDate>Tue, 01 Jun 2021 17:20:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:35f58dbc-795f-4503-a15d-a0cfcf9bff17</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Bad idea. Appian has no way to restrict that to certain functionality so your users might do malicious&amp;nbsp;things.&lt;/p&gt;
&lt;p&gt;A while ago I had to create a rating mechanism which enabled users to take values of fields and do certain calculations on each. The sum of weighted results is stored as rating.&lt;/p&gt;
&lt;p&gt;Similar functionality can be implemented with a bit of effort. A table in DB holds all the calculations for each&amp;nbsp;field. Users have a UI to define this. Some looping logic evaluates these definitions.&lt;/p&gt;
&lt;p&gt;Would that fit?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>