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--;
You cannot implement a while or a do while loop in Appian. You only have to live with a!forEach. It expects a list to operate on. This loop will run once for every item in the list.
Now to exit the loop in between, is not possible. But what is possible is to set the output value after your condition to null and then outside the loop, remove all the null values using reject() function.
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.
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.