Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
14 replies
Subscribers
7 subscribers
Views
5369 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
The function "doforeach" allows me to call a function by string. I use
shelzle
over 12 years ago
The function "doforeach" allows me to call a function by string. I use this to dynamically call a function that is defined in a text PV of a process. Is there any other method to do dynamic function calls? The new looping function "apply" does not work....
OriginalPostID-65702
OriginalPostID-65702
Discussion posts and replies are publicly visible
0
revat.anandsongkit
Appian Employee
over 12 years ago
Stefan, can you provide a little more context as to what you are trying to achieve?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Shaun Kilby
Appian Employee
over 12 years ago
Could you please describe the use case for using the apply function? In most cases, it should be a great alternative.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
shelzle
over 12 years ago
Sure. I have a process dashboard on which I want to display some data. The process itself can be of several "kinds". For each kind I have a expression rule that renders some HTML to be displayed on the dashboard. In the PV I save the name of this function and call it dynamically using "doforeach" with a single item list. This works now since nearly 3 years.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
shelzle
over 12 years ago
Apply does not allow me to use a string as the function to call.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
revat.anandsongkit
Appian Employee
over 12 years ago
You should save your function as an expression rule and call the new expression rule in your apply() function.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
elizabeth.epstein
over 12 years ago
Specifically, instead of doforeach("myexpression", pv!parameters) it will be apply(rule!myexpression,pv!parameters)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Owen Parrish
Appian Employee
over 12 years ago
You could use nested ifs.
=if(pv!processKind="a", apply(rule!ruleA), if(pv!processKind="b",apply(rule!ruleB),if(pv!processKind="c",apply(rule!ruleC),"etc")))
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
shelzle
over 12 years ago
My current rule looks like this
doforeach(ri!extension.display_function, {ri!data})
and it does axectly what I want. My dashboard is part of a framework for a generic ticket management system and by using dynamic function call with doforeach I have an easy way to show different content on the dashboard.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
shelzle
over 12 years ago
Being able to cast a string to a function reference would solve my problem :-)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Medhat Galal
Appian Employee
over 12 years ago
Please state what version you are using.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>