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
Hi , create a rule input in your expression rule. Once you use this expression in a process model then pass the process variable into it. For example if you have a rule called "getEmployeeDetails" and you have rule input "employeeId" in it. Then , when you call this rule in process model ,it should look like below,
rule!getEmployeeDetails (employeeId:pv!employeeId).
So in your case , create a rule input of "paymentDate" and then, once you call it in process model pass the process variable.
this expression is not returning value. But the stored proc has values.
Yes, the first checks whether it has empty value.
The second executes if the value is not empty.
Is it being called on a different date in the two different spots? I couldn't tell as your original screenshots cuts off what value is actually passed in.
it's calling the same date. This issue is now resolved. I noticed that the previous expression calling the stored proc needed the fv!items.xxxx to match the xxxx in the current expression. It was a case sensitivity issue. caseid != caseId.
I'm glad to hear you got the surrounding syntax issues worked out. Though I was getting at something else with my comment here.
I guess my point here was that if you're calling the same stored procedure in the same way twice, just to check whether it returns empty, then what you should be doing is calling it just once, setting that value into a local variable, and then check that variable to see if it's empty. There's no reason to call it twice when you only need to call it once.
Please, can you show me a sample of how to do that?
Thanks
docs.appian.com/.../Local_Variables.html
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
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.