cancel
Showing results for 
Search instead for 
Did you mean: 

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

Abhijit
New Contributor

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?

3 REPLIES 3

shodge
Former Employee

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:

cb77f026f2360e9e8a9e658351986c116ce63315.png

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

Thanks,

Shayne

Piyush
New Contributor III

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

anu
New Contributor

Hi Can you please provide an example for the above?