I need to create a rule containing other rules and execute them based on input.
To make it generic and durable, the intention is to never have to modify the upper rule and only create the new rules that arise according to the needs.
Perhaps now the list of possible rules to execute is 10 and every month one more rule should be added for example.
My question is if there is any way to print all the calls to the "internal" rules in my superior rule? As for example having a table in DB with a column that contains the name of the rules, print that column in my general rule so that when I add in the table a row with a new name of a rule, it can be called from the general rule.
I have seen the possibility of using the doforeach function, but it is deprecated.
Do you know of any similar current functionality or can you think of a way to attack this problem?
Thank you very much
Discussion posts and replies are publicly visible
There is an unlisted function (therefore not officially supported, endorsed or even acknowledged by Appian and not for use in anything that will ever see a Production system) that does something like what it sounds like you're asking for.
I strongly recommend that you do not use this function - it is unsupported and there is no guarantee that it will behave how you expect.
Instead, I'd recommend thinking about whether you could create an expression rule for this that could work as a template. For example, suppose that you have several functions that you want to call on demand - the simple case I'm thinking of is whether you want to apply cleanwith or stripwith to a value. It's actually possible to store a function in a local variable that can be called on demand. In this case, I created a dictionary with a name and the function to call. Then, if I provide the input for the correct function short name (clean or strip), it will call the corresponding function with the parameters I provide below.
(Of course, there's even simpler ways to set this up for this basic case - a simple if() statement would also work. However, this demonstrates how to store a function in a local variable and call it on demand.)
a!localVariables( local!functions: { {name: "Clean", function: fn!cleanwith}, {name: "Strip", function: fn!stripwith}, }, if( contains(touniformstring(local!functions.name), ri!functionName), displayvalue( ri!functionName, touniformstring(local!functions.name), local!functions.function, null ) ( ri!text, ri!withCharacters ), ri!text ) )
I second this.