Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this article

...

Learn More: Using the Mapping Table.

...

Examples

Removing Columns from Excel Files Using Mapper

...

You now need to write the updated data back into the SLDB as a JSON file. To do so, you add a JSON Formatter Snap to the Pipeline to convert the documents coming in from the Mapper Snap into binary data. You then add a File Writer Snap and configure it to write the input streaming data to the SLDB.

...

You can now view the saved file in the destination project in SnapLogic Manager.

...

Download this Pipeline

Example Data Output

Successful Mapping

If your source data looks like:

...

Code Block
{
  "full_name": "John Smith",
  "phone_num": "123-456-7890"
} 
Unsuccessful Mapping

If your source data looks like: 

...

  • Expression$middle_name.concat(" ", $last_name)

  • Target path$full_name 

An error will be thrownis displayed.

Example

Escaping Special Characters in Source Data 

...

If the Escape Character is 

Use Expression

Sample Output 

Single quote (') 

JSON:

$original.mapValues((value,key)=> value.toString().replaceAll("'","''"))

OR

$original.mapValues((value,key)=> value.toString().replaceAll("'","\''"))


CSV:

$[' Business-Name'].replace ("'","''")

Image RemovedImage Added

Ampersand (&)


JSON:

$original.mapValues((value,key)=> value.toString().replaceAll("'","\&'"))

OR

$original.mapValues((value,key)=> value.toString().replaceAll("'","&'"))


CSV:

$[' Business-Name'].replace ("'","&'")

Image RemovedImage Added

Backslash (\)




JSON:

$original.mapValues((value,key)=> value.toString().replaceAll("'","\\'"))


Info

Backslash is configured as an escape character in SnapLogic. Therefore, it must itself be escaped to be displayed as text. 


CSV:

$[' Business-Name'].replace ("'","\\'")

Image RemovedImage Added

In this way, you can customize the data to be passed on to downstream Snaps using the Expression field in the Mapper Snap. 

Refer to the Community discussion for more information.

See it in Action

The SnapLogic Data Mapper

Widget Connector
overlayyoutube
_templatecom/atlassian/confluence/extra/widgetconnector/templates/youtube.vm
width400px
urlhttp://youtube.com/watch?v=NwwujRSCgvk
height300px

...

Insert excerpt
Transform Snap Pack
Transform Snap Pack
nopaneltrue