Scenario to achived rownumber function in sql

How can I achieve rownum() funtion in Snaplogic?

I have a input data
Column 1
need output
Column1 Column2
a 1
b 1
c 1
a 2
a 3

How can I achieve this?

Hi Dipanjan,

You can use the string method charCodeAt


($Column1.toLowerCase().charCodeAt(0) - 97) + 1

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?

The expression might be what you’re looking for, but I’m really not sure based on your example.

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

Sorry, can you please explain more specifically what you mean by that? What is the partitioning rule?

My bad, I thought column2 is base from the character from column1 :slight_smile:

Hi @dipanjan.pan,

I hope this will help you :slight_smile:
SnapLogic_Community_2021_05_31.slp (7.2 KB)


1 Like

Thanks a lot @viktor_n …it works