cancel
Showing results for 
Search instead for 
Did you mean: 

Can We create a Variable in Mapper

Karan_Mhatre
New Contributor II

Hello Everyone,

I am trying to create an incremental addition let say i have 2 columns empl_id and salary so in target i want to derive third column with cumulative salary.

I can do it by using variable, have done it using Different tool but never implemented it in snaplogic

Hence the question can we create Variable in mapper?

any help is appreciated

21 REPLIES 21

@bhupender.singh

Understood your code with the help of Google bcoz i dont know python but was able to relate it
Thank you for your reply .
but can i do the same thing with csv file?

Again thank you mann for your help

bhupender_singh
New Contributor III

@Karan_Mhatre yes you can use file reader and csv formatter to get output similar to the Json generator I have used.

Preeta
New Contributor II

Hello @Anil , I am trying to implement similar logic but i need to group by two fields instead of one unlike in the above example. Instead of only emp_id , I have two fields i need to consider, suppose product_name and product_date , and then find the cumulative sum for this combo . Can you please help me with the logic for this?

Anil
New Contributor III

@Preeta Sure…

Can you send the input file and what is the output expected…

Hi Preeta,

One way to solve this is to concatenate the two fields into a single one in a mapper snap, then use that to aggregate the data like the solution for a single field.

Best,
Tim