Hi All,
I am passing one dynamic value in expression rule in textField to display value but rule is not getiing refresh n taking old value only.
Here below rule should take dynamic value n on t he basis of that should return respective value .
Below field in in with(). What could be the root cause of that please share.
a!textField( label: "Name", value:rule!getNamebyId(local!data.requestId), readonly: true() )
Discussion posts and replies are publicly visible
Do you use local variables inside that expression?
yes
If you use load() or a!localVariables, change it to with() or add a!refreshVariable(refreshAlways: true).
Fixed-
Load first data outside with n play around that data in with(). It fixed my issue but i feel something should be more optimized way for this problem.
a!textField( label: "Name", value: index( local!nameDetails.name, wherecontains( tostring(local!masterData.id), touniformstring(local!nameDetails.id) ), null ), readonly: true() )
Loading lots of data into memory and then trying to search for matches is typically a bad idea. Did you try my suggestions? Would you mind posting the code of your expression (use Insert -> Code)?
As a point of clarificaiton, while you're totally right about load(), I belive in >99% of use cases, a!localVariables() will work in expression rules as-desired without needing to set "refreshAlways" (or any other a!refreshVariable() modifications). The possible exceptions being when the expression rule sets a dynamic value based on something other than a potentially-changed rule input, such as capturing the current time for some reason.
Sure I will try your approach first n then will re u ode if not works.
Thanks for your inputs.