Hello everyone,
I need to do a expression rule which will return a unique code.
So my expression will need to generate a code (done already), verify if exists already in the database, if yes, the expression will need to generate another code, until it does not exists in the database.
I checked loop functions in Appian and does not find the While loop function, but rather functions with known iteration like "forEach", "apply".
Thank you in advance.
Nanbei
Discussion posts and replies are publicly visible
Hello Nanbei,
First and foremost, it is not recommended to run the query entity(or any kind of DB calls) inside a loop. You can create a stored procedure and move the same logic to the database side. So that the performance will not be affected and you can use the while loop in the Stored Procedure.
Or if the code is just a unique number, then you can just make of use of the auto-generated primary key column.
thank you for your reply, and sorry to reply you this late.
I solved the issue by generating a new type of code.
I asked the previous question because the application which I am developping need to import data from other data bases and to avoid any conflicts I finally generate a new type of code from Appian.
Thank you :)