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
This seems almost wastefully expensive.
By that I mean this is excess, inefficient process. Don't guess and check new codes.
I expect there are at least 2 alternatives, (but probably more)
1st - https://community.appian.com/w/the-appian-playbook/846/generating-guids - you can make a guild with expressions.
2nd - both Oracle and SQL server will manage unique sequences for you, you should be able to pull them.
3rd - if you don't have the luxury of Oracle or SQL Server, you can make a "codes" table in mySQL where the PK is your new code. just make new rows in that table and use the id value as your code. It doesn't have to start at 1.