Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: dglavastormHi
I need have two datasets joining together with a sequential Unique Key field in one but not the other.
I need to create the Unique Keys for the second dataset, but to do that I first need to know what the max value of the Unique Key is in the first dataset so I can sequentially generate the new Unique Keys.
I can't find any code to do this. I can use the Tail node to find the max value, but that won't help as I need to use the max value as a variable to generate the new keys, not create a new field.
I can't even do a join to bring this field in as there is nothing to join on.
Generating the key is with the below code, I just need to know how to find the max value in the existing data and use it in a formula, replacing the P_Key = 0 with P_Key = Max value from previous dataset.
if firstInGroup then P_KEY = 0
P_KEY = P_KEY + 1
Example data attached.
Cheers,
Dave
Attachments:
max value.zip