05-29-2021 03:13 AM
How can I achieve rownum() funtion in Snaplogic?
I have a input data
Column 1
a
b
c
a
a
need output
Column1 Column2
a 1
b 1
c 1
a 2
a 3
How can I achieve this?
05-29-2021 07:26 AM
Hi Dipanjan,
You can use the string method charCodeAt
e,g
($Column1.toLowerCase().charCodeAt(0) - 97) + 1
05-30-2021 02:27 PM
My bad, I thought column2 is base from the character from column1 🙂
05-29-2021 10:03 AM
I’m not understanding your example. If Column 2 is supposed to be your rownum() value, why wouldn’t the values be 1, 2, 3, 4, 5 instead of 1, 1, 1, 2, 3?
05-29-2021 11:55 AM
rownum based on some partition by column. In this case I want the output based on column 1. thats why it is 1,1,1,2,3