cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a unique id in snaplogic

Sowmya_Rayavara
New Contributor III

Hi Team,

Can you please let me know how to generate a unique ld like the below one in snaplogic.

1553020781234-4901709987102371234-03202019DFF456F123

Thanks in Advance!

22 REPLIES 22

vincenr
New Contributor III

Can someone explain how I would get a unique GUID for every row in a SQL query I’m sending using a REST POST snap?

koryknick
Employee
Employee

In an expression:
Math.randomUUID()

For example, in a Mapper snap:
image

vincenr
New Contributor III

I’m doing the following but it only gives ONE unique value, the same value, for ALL rows:

[Entry].EntryID, ‘" + Math.randomUUID() + "’ as [Blank Number], [EntAppSts].

I need a unique value for each row in my SQL query, not one unique value. Using the mapper snap will only give one unique value and won’t work for all rows in my query, unless I’m missing something?

koryknick
Employee
Employee

That is because the expression to build the SQL is inserting the random value only once when the SQL statement is generated and parsed for the Select statement that is executed, so SQL Server is treating it like a static string. Try moving it to a Mapper snap after the Execute snap.

Otherwise, you may need to find the syntax for SQL Server to generate a GUUID.