cancel
Showing results for 
Search instead for 
Did you mean: 

Error in the Snaplogic Mapper for excel Merged fields

Arijit
New Contributor

I am trying to process a excel file using Excel parser and on the mapper we want to pull the previous not null value for a field if the value of the field is null for which have tried the below expressions but snaplogic is giving error .

Arijit_0-1701520639965.png

option 1 :

$Value == null ? $Value.substring(0, $Value.length() - 1) : $Value

option 2 :

$Value == null ? $previous.Value : $Value

Error :

Failure: Expression worked for 1 previous document, but failed on document #2 with the error: $previous is undefined. Perhaps you meant: $B, $Label, $Value, Reason: 'previous' was not found while evaluating the sub-expression '$previous', Resolution: Check the spelling of the property or, if the property is optional, use the get() method (e.g. $.get('previous'))

The Excel file that I am trying to process has the rows as below :

Arijit_1-1701521098560.png

1 REPLY 1

koryknick
Employee
Employee

@Arijit - please download the attached zipfile, decompress it, and import the SLP into your org to view the example pipeline I've given.  Since SnapLogic is a streaming platform, it does not inherently support access to previous documents, so this example uses the Script snap to save previous non-null values for the "Value" field and continue to reuse it until a new value is present in the current document being processed.

Note that I have marked my changes to the default script that is generated with "// ***"

Hope this helps!