Generating unique reference

Generating unique reference


I'm a new user to the outsystems platform and i'm trying to build a demo Gap analyses application where the users can key in a test case with there own reference and key in a child Gap which should get an automatic numbering eg. GAP-0000001.

Could you point me out to the right direction how I can achive this?

I've tried to create a method (action) in the integration studio but i fear my C# knowledge lets me down.

note: I'm using the community platform edition

Best Regards,
If you create an entity the ID will be a autonumber. What is stopping you from (ab)using that?

just when creating a record, update the record afterwards in the column with the desired key-value?
(smak to the head)

Ofcourse, thanks!

So in a flow:
1. Fill in my edit record source
2. CreateOrUpdate
3. Get ID from the CreateOrUpdate method and transform with "GAP-" + Right("000000"; id) (or something like that)
4. Update back again to the database?

or do you advice anything different?

bullet 3 means you will update a different column, not the id itself ofcourse.

about the advice, I'm just giving you a possible solution to the question you are asking :)

If you ask my advice I probably would say something different depending on the requirement you have.
Yes I update a reference field.
My question to advice if below is OK is just if it will not conflict any damage to my database. Not if it is inscope with my project as i think this will cover my needs on that part.

Anyhow many thanks for this direction, I've tested it and it works great.

1. Fill in my edit record source
2. CreateOrUpdateGap
3. Check if its a new record
4. Assign edit record source: Id = CreateOrUpdateGap.Id
5. Assign edit record source: Reference = "GAP-" + id
6. UpdateGap

Only chalange to fix is to have GAP-0000001 instead of GAP-1 as example above as the build in function does not contain the "Right" function.
"Only chalange to fix is to have GAP-0000001 instead of GAP-1"

If I'm not mistaken, you could use the FormatText built-in function to pad the number with 0s.

As Killian said, use FormatText:
Reference = "GAP-" + FormatText(CreateOrUpdateGap.Id,8, 8, true, "0");