Pickup string from source file-name to use in pipe-line

I need to read the plant-code which is either part of the source file-name or folder-name that is read via SFTP and then generate an output file with the same plant-code as part of the target file-name. How can I do that?
The second part of the same question is, I need to use the same plant-code in a mapper snap, to apply mapping logic based on plant-code. How can I pick-up the plant-code into a variable or constant, to use in the mapper?

How are you specifying the filename right now in the File Reader Snap? If you make the filename a pipeline parameter, you’ll have access to it throughout the pipeline:

Then you can use string functions in a mapper to create the name you want. (It may be easier if you make the path and the file separate vars, and then do a _path + _file in the reader. Note that pipeline parameters are referenced with a leading _, and not a $.)

These are the string functions - if you can give a bit more information about the pipeline I can be more specific. http://doc.snaplogic.com/strings



Every file read will give you content-location

“content-location”: “”.

You can use string functions to extract the filename and path from here and use in mapper or filewriter

1 Like