Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Suggested Answer
Replies
9 replies
Answers
2 answers
Subscribers
9 subscribers
Views
11257 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Is there a way to make parameters on an expression rule optional?...
moritzw
over 11 years ago
Is there a way to make parameters on an expression rule optional?...
OriginalPostID-35469
OriginalPostID-35469
Discussion posts and replies are publicly visible
0
Michael Tan
Appian Employee
over 11 years ago
There is no way to do this. The rule will complain if there is not the correct number of parameters passed. If the value is optional in process, then make your rule account for this by checking for null values.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Miguel Garcia-Gonzalez
over 5 years ago
If you don't give a parameter a value when you are calling an expression rule the value will be set as null by default, but you still need at least a parameter being passed to avoid an error message asking for those parameters.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Ashvin Kapur
over 5 years ago
Parameters on an expression rule are technically always optional - if you use the [parameterName]: to define your parameters, the process/rule will always pass in null for any parameters skipped. As Miguel has stated, there is a requirement to pass in at least one parameter if parameters exist in the expression rule, but if that's a problem for whatever reason, you can create a dummy variable that does nothing within your rule.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Reject Answer
Cancel
0
Abhay Giri
over 5 years ago
Hi Moritzw,
As technically parameters in expression rules are optional always. If you don't want to pass any parameter value in the rule then simple pass the values by key-value expression.so for the missing key(parameter) it will take value Null as default.
Regards
Abhay
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Reject Answer
Cancel
0
Shanmukha
A Score Level 1
over 5 years ago
Hi Morit,
Could you please why you would like to make parameters as optional?
Thanks..!!!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
gurdeeps
over 5 years ago
Hi, there is no way that an expression's parameter can be optional, but you can pass the parameter in key value pair (name:ri!name), here you can pass ri!name such that it should not have any impact in the evaluation of the rule.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
krishnau3863
Certified Senior Developer
over 5 years ago
Hi moritzw,
Yes, it is optional to take parameters in expression rule, if you are going to get the data by passing any parameter then it is needful, or else without using the parameters also we directly fetch the whole data from DB.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Dave Lewis
Certified Lead Developer
over 5 years ago
in reply to
krishnau3863
if myRule is a function with parameters: parameter1, parameter 2, and parameter3
the following code:
rule!myRule(
parameter1: local!something
)
works just fine. Strangely,
rule!myRule(
parameter1: local!something,
parameterIJustMadeUp: local!somethingElse,
)
also happens to work just fine. It ignores what you don't send. It ignores what you do send that it doesn't recognize, and doesn't even give you a warning. If you happen to misspell one of your keywords it can be ages to find the error.
You do have to send at least one of the parameters by keyword.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
Certified Lead Developer
over 5 years ago
in reply to
Miguel Garcia-Gonzalez
Miguel Garcia-Gonzalez
This thread is from June 2012...!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel