Forum Discussion

SL12345's avatar
SL12345
New Contributor III
3 years ago
Solved

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...
  • koryknick's avatar
    3 years ago

    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" : Date.now().minusDays(1).toLocaleDateString() }.extend($)