It sounds like you’re not changing the data at all, just outputting the fields requested by
Input2 and in the order they appear there.
If that’s the case, then the Mapper snap will do you no good. It’s primarily for data transformation (although it can be used to drop or inject properties on docs in the docstream).
I work primarily with SQL RDBMSes and/or externally-originating JSON streams, so I haven’t played around with the CSV snaps much in SnapLogic. I would investigate the entire suite of those, if I were going to do a lot with CSVs.
If I were personally building this right now in a hurry, though, I think the most straightforward way would be mostly done inside a Script snap.
Those are the 3 scripting languages available in SnapLogic.
Your pipeline might look something like this:
You pull in your data from file
input1 and it comes in as a series of JSON docs, 1 doc per row, and each doc has property names matching the column headings. You have “has headings” turned ON in the top CSV Parser to do this.
input2 you get just the list of column names. (Turn OFF the “has headings” in the CSV parser. You don’t have data with headings; the headings are the data in this case!)
If this doesn’t get you the columns from
input2 in the order they occur, you may have to forego the 2nd CSV Parser and use a “Binary to Document” snap instead. You might have to play around with this to get the list of columns into the docstream in a way that you can know for certain the correct ordering that was wanted.
At the point you start writing the script, it should be pretty easy from that point on. Grab the list of output fields (and their ordering) from wherever in the doc stream you’ve put them. Then, for each document containing a data row from the
input1 file, copy only the requested properties to the output, in the order requested.
Hope that helps!