Forum Discussion
1 Reply
- cjhoward18Employee
Hi @wahlborn
I’ve attached a pipeline that has generated documents with 5 columns like your example above, while extracting the last 3 columns of values, and writing them to a file with each value on it’s own line.
Please note that the order of values is not guaranteed, and that this is a quick solution to show you a POSSIBLE way of achieving this formatted output file.
The pipeline could most likely be better optimized.
last3ColumnsToFile.slp (25.6 KB)
- wahlbornNew Contributor II
Thanks so much! This is very helpful.
- cjhoward18Employee
Here is a new slp which includes two new solutions to your problem, more optimized than the one given above earlier.
The solution using the pivot snap sorts by the column names, which might not result in the same order as coming in. It works now because the columns are C, D, E. But, if the last three columns in the real thing are not alphabetical, it might not work like you want.
The solution using the mapper snaps does not have the problem listed above. So, depending on your desired behavior you can choose and play with the solutions to fit your use case.
Also note, these solutions are using the actual column names themselves that are to be collected and written out, so if those plan to change this will need to be edited accordingly to handle that.
PivotQuestion_2019_08_29.slp (14.6 KB)
- SupratimContributor III
The easiest way (but not professional way) to do this-
1.use copy snap and make three output view.
2. use one mapper with value of CloumnC and count var=1. (make use target value for all ColC,ColD,ColE should remain same. )
3. use one mapper with value of CloumnD and count var=2
4. use one mapper with value of CloumnE and count var=3
5. Use union to marge all 3 views.
6. Use sort snap by count variable.- wahlbornNew Contributor II
Thank you! Can you explain further; I don’t know what you mean by implementing a count variable?
- SupratimContributor III
TestData.slp (12.9 KB)
@wahlborn Please use the attached pipeline.