Adding column at the beginnging of mapped array

Hi snaplogic experts,

i have csv file with 56 columns. In order not to map field after field and have 56 rows in mapper, iam using this function (mapping and replacing . with , ).

$.mapValues(x => x.replaceAll('.', ','))

but my problem is: i need to add yesterdays date as first column.

is there any chance to add column to this function or do i need to map all columns and new column will be added as first column?

thank you

I’m not sure what the mapValues is doing in your example, but you can use extend() to add to the JSON document. In this case, you would create a new object with your “yesterday” field and extend that with the incoming object. Something like this:

{ "yesterday" : }.extend($)