FAQ: TFORMer Designer
How Can I Create a Version 4 UUID?
How Can I Create a Version 4 UUID?
Following the rules in this specification: Generate a UUID compliant with RFC 4122 (cryptosys.net) the TFORMer expression would be as follows:
RandomStr (8, "1234567890ABCDEF") + "-" + RandomStr (4, "1234567890ABCDEF") + "-4" + RandomStr (3, "1234567890ABCDEF") + "-" + RandomStr (1, "89AB") + RandomStr (3, "1234567890ABCDEF") + "-" + RandomStr (12, "1234567890ABCDEF")
This generates a (random) UUID of version 4 such as:
59C2BC34-E239-4DEE-A714-2143E9717B60
On the other hand, if you only need a random string, you can simply use this:
RandomStr (32, "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ")
The function returns a different UUID every time it is called.
To use it more than once, you can put it in a calculated field.
If the same UUID should be used across multiple records (the value should not change between records), you should evaluate the UUID only one time at the beginning of the report. To achieve that, add a report header (can be zero height), then add a pre-evaluation to the header section where you assign the calculated value to a UUID text field, which is later used in the layout.
If the same UUID should be used across multiple records (the value should not change between records), you should evaluate the UUID only one time at the beginning of the report. To achieve that, add a report header (can be zero height), then add a pre-evaluation to the header section where you assign the calculated value to a UUID text field, which is later used in the layout.