07-13-2019 12:38 AM
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
07-15-2019 09:13 AM
Can you give more information about where the cumulative salary column will come from? If it’s just a sum of all the salary columns and grouped by the employee id, then you could use the Aggregate snap.
Here’s an example I put together based on what I thought you were looking to do.
Feel free to download this pipeline and try it out.
Aggregate-Example_2019_07_15.slp (3.9 KB)
07-15-2019 11:04 AM
Hi tlikarish,
Appreciate your reply but that does not solves my query.
Below is the data:-
employee_id,salary
10, 1000
20, 2000
30, 3000
40, 5000
Expected O/p
employee_id,salary,Cumulative salary
10, 1000,1000
20, 2000,3000
30, 3000,6000
40, 5000,11000
Hope now its clear , Also i tried to Google for variable in mapper but there was no comments or article on it.
Can we not create a variable in mapper? because these can be done in different ETL tools using variable.
07-15-2019 11:19 AM
The aggregate snap has a concat function that should concatenate the values instead of sum them. I think that maybe closer to what you’re trying to achieve.
You could also take a look at the Group By Field snap, but that may be too different from how you’d like to transform the data.
In regards to variable creation, there is nothing like that in the mapper. You can transform document properties using expressions and write them to new properties, but there aren’t any variables you can use.
07-15-2019 11:37 PM
No tlikarish, i dont think concat function will help me.
Anyways there should be a new way ,Only the problem is we have to figure it out 😀
Thank you for your help, Appreciate it.