cancel
Showing results for 
Search instead for 
Did you mean: 

Creating unique ID's and repeating

aditya_gupta41
Contributor

Hello Experts,

I have a JSON input looks like this:

[
{
"id": "0000000",
"type": "DUMMY_Payload",
"userId": "ABCD1234"
},
{
"id": "1111111",
"type": "DUMMY_Payload_1",
"userId": "QWER5678"
},
{
"id": "2222222",
"type": "DUMMY_Payload_2",
"userId": "ABCD1234"
}
]

The ask is that I have to bulk upsert these values to Snowflake DB. However, there is one process that are needed to be conducted:

We need to first encrypt userID in custom encryption format like XXXX123, XXXX456 and so on. Any repeating userID will have the same encrypted userID as that of first. Below is an example:

ABCD1234XXXX123
QWER5678XXXX456
ABCD1234XXXX123

Does anyone know how to achieve this via Snaplogic in the most optimized way so that the performance should not hamper?

 

Thanks in Advance

1 ACCEPTED SOLUTION

aditya_gupta41
Contributor

Solution:

I first used group by snap to group userID fields. Next I put a mapper and added a custom encrypted value with expression

'XXXX'+sl.range(4).map(x => "0123456&#X"[Math.round(Math.random()*9)]).join('')

 Then I added a JSON splitter to split the group and included value of custom encryption.

View solution in original post

1 REPLY 1

aditya_gupta41
Contributor

Solution:

I first used group by snap to group userID fields. Next I put a mapper and added a custom encrypted value with expression

'XXXX'+sl.range(4).map(x => "0123456&#X"[Math.round(Math.random()*9)]).join('')

 Then I added a JSON splitter to split the group and included value of custom encryption.