I am trying to pass the value of a process variable into my expression, and the expression is also used in the process model.
Please, see attached image:
The rule - drxxxxStoredProcedureDirDepAggregatedPaymentForDate looks like this:
executestoredprocedure( datasourceName: "jdbc/ABC", procedureName: "dbo.procCtePaent", inputs: { { name: "date_param", value: "" } }).result[1]
Discussion posts and replies are publicly visible
You're already setting one local variable, local!lines - you'd just create an earlier local variable within your load() statement (though i beg you to please switch this load() out for a!localVariables() for your sanity and mine), move the stored procedure call to that local variable, then refer to the local variable in the subsequent places you called the SP directly.
This would look a little something like:
a!localVariables( local!procedureResult: rule!mySuperLongStoredProedureExpressionRuleName("3/17/2022"), local!lines: if( a!isNullOrEmpty(local!procedureResult), {"No Data, 0.000000.123456789.0 etc"}, { a!forEach( items: local!procedureResult, expression: { /* all your code here would be essentially unchanged */ } ) } ) )
Thank you, Mike. I have tested it and it worked. Is there a reason you used a!localvariables instead of load
Thanks
Hi nicholaso0002, I am not sure if you are aware but a!localVariables is one of the latest functions which Appian has introduced from 20.2 . It has significant advantages over load and with. You will have more control over how your local variable refreshes in combination with a!refreshVariable. it simplifies the UI and helps you to create more efficient interfaces.
Please go through the documentation to know more,
https://docs.appian.com/suite/help/22.1/fnc_evaluation_a_localvariables.html
Gopalk beat me to it. My current recommendation is to not use load() under any circumstances, and that legacy code using it should be converted as soon as convenient since load() and its sister function with() are deprecated now.