Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to shift a column header names into row values

Hi,
I have a scenario to be processed as below:
1. An Input "|"delimited file to be processed which is of the below mentioned schema (with sample data):
CARDID|CARDNAME|SLOTNAME|SHELFNAME|NODENAME|LOCATIONNAME|NODETYPE
661813|DD|Slot 4|Shelf 1|T-T080176 _C01_R01|T-T080176|SDH
661821|DD|Slot 4|Shelf 1|T-T080178_C01_R01|T-T080178|PDH
661878|UU|Slot 1|Shelf 1|T-T090002_C01_R01|T-T090002|SDH
661900|DU|Slot 3|Shelf 1|T-T050049_C01_R01|T-T050049|PDH
661914|UU|Slot 1|Shelf 1|T-T050065_C01_R01|T-T050065|MSC
3. The expected is to arrive at two output files where the first one is straight mapping as shown below(OUTPUT1):
CARDID|CARDNAME|SLOTNAME|SHELFNAME|LOCATIONNAME
661813|DD|Slot 4|Shelf 1|T-T080176
661821|DD|Slot 4|Shelf 1|T-T080178
661878|UU|Slot 1|Shelf 1|T-T090002
661900|DU|Slot 3|Shelf 1|T-T050049
661914|UU|Slot 1|Shelf 1|T-T050065

The second file should be in the below mentioned format(OUTPUT2):
CARDID|UDA_NAME|UDA_VALUE
661813|NODENAME|T-T080176 _C01_R01
661821|NODENAME|T-T080178_C01_R01
661878|NODENAME|T-T090002_C01_R01
661900|NODENAME|T-T050049_C01_R01
661914|NODENAME|T-T050065_C01_R01
661813|NODETYPE|SDH
661821|NODETYPE|PDH
661878|NODETYPE|SDH
661900|NODETYPE|PDH
661914|NODETYPE|MSC
In the above output you can see that the Input Header columns became the row values. I understand that this shall be achieved through using multiple tFileInputDelimited and tmap components for each of the column headers and atlast merging all the files to form a single output.
The problem is there could be more number of columns which has to be processed in this fashion. So I am seeking help to achieve this in an easy manner.
Regards,
Karthik
Labels (2)
6 Replies
Anonymous
Not applicable
Author

Hi,
The component tMap can achieve your goal.
The workflow should be: tfileinputdelimited-->tMap-->tfileoutputdelimited(output1)
-->tfileoutoutdelimited2(output2)
-->tfileoutoutdelimited3(output2)
Please see my screenshots for detail.
Best regards
Sabrina
0683p000009MAtx.png 0683p000009MAvn.png
Anonymous
Not applicable
Author

Hi Sabrina,
Thanks for providing the solution. I tried the same and got three output files in total,
tfileoutputdelimited(output1)
tfileoutoutdelimited2(output2)
tfileoutoutdelimited3(output3)
whereas I am expecting only two files
Is there any simple way to merge both the Output 2 & 3 files.
Regards,
Karthik
Anonymous
Not applicable
Author

Hi Sabrina,
I got the solution. I used tUnite to merge both the Output2 &3 files to make it as a single file.
Thanks for your support.
Regards,
Karthik
Anonymous
Not applicable
Author

Hi,
tfileoutputdelimited(output1)
tfileoutoutdelimited2(output2)
tfileoutoutdelimited3(output3)
whereas I am expecting only two files
Is there any simple way to merge both the Output 2 & 3 files.

Actually, you should use a same output file path when setting tfileoutoutdelimited2 and tfileoutoutdelimited3.
The workflow should be: tfileinputdelimited-->tMap-->tfileoutputdelimited(output1)
-->tfileoutoutdelimited2(output2)
-->tfileoutoutdelimited3(output2)

Please check out the option "Append" both in tFileoutputdelimited2 and tFileoutoutdelimited3 component.
See my screenshots
Best regards
Sabrina
0683p000009MAvs.png 0683p000009MAvx.png
Anonymous
Not applicable
Author

Thanks alot.. Its working fine.
Regards,
Karthik
Anonymous
Not applicable
Author

Hi,
It is welcome to post your issue on forum.
Best regards
Sabrina