How to implement while or do while logic in expression rule?
Discussion posts and replies are publicly visible
Could you please elaborate your requirement? Why you are looking for while and do while logics?
something similar like this
While(i<31)
{
if(i=15)
exit;
}
else
i--;
There has to be some way to implement the same logic since While and Do while basic looping functionality in programming languages.
I tried any() function but it is giving me error.
Any is the looping function you can not use that.
I need looping function where condition of the loop return true or false.
In that case you have to use if condition only.
There are 1000s of such use cases. Can you be more precise, please? Because for what you mentioned, you don't even need a loop. Example -
consider i have a data which is of key(ID) value pair( fetched from database ), and value is of finite number of types and i get key as a input,.........so first i need to check the value of the key and if its what i wanted then its fine or else i need to decrement the value of the key ( previous key value pair) untill i get the desired value.
in the key value pair important is the value part.
We do not have a looping function that would stop based on a condition. All you can do is use a!forEach just like Harshit mentioned in his answer. You might have to do it in multiple steps, at least two. The first one to exclude values greater than 31, for which you can use filter, reject, wherecontains, and/or a!forEach. Second step would be to update each item in array based on the condition specified inside the while loop, for this you can use a!forEach.
shreeharshan0678
a!localVariables( local!keyValPair: { { id: 1, value: "This is a text value" }, { id: 2, value: 12 }, { id: 3, value: {1,2,3,4} } }, displayvalue( 12 /*Desired value that you want*/, local!keyValPair.value /*Place where you want to search it for*/, local!keyValPair.id /*Field of the matching index that you wnat to return */, "Not available" /*Default value if the desired value was not found*/ ) )
Thank you for your help.