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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
lemufty
Contributor III
Contributor III

[resolved] how to transform row to column

hi,
i want to transform column to row. columnName and Columnvalue come from dynamic column(dyn)
column=row1.dyn.getColumnMetadata(columnIndex);
columnName=column.getName();
columnValue=(String)row1.dyn.getColumnValue(columnName);
   In output, i have columnName, columnvalue.sample example below:
AccountNumber;1223  
AccountSubType__c;bonjour
ActivityIdentificationCode__c;bonsoir
AsstEmail__pc;kpk@gmail.com
AccountNumber;1223qwx
AccountSubType__c;bonjours
ActivityIdentificationCode__c;bonsoirs
AsstEmail__pc;bs@yahoo.fr
so after, i want to have the structure below:
AccountNumber;AccountSubType__c;ActivityIdentificationCode__c;AsstEmail__pc
1223;bonjour;bonsoir;kpk@gmail.com
1223qwx;bonjours;bonsoirs;bs@yahoo.fr
i need your help
Labels (2)
5 Replies
Anonymous
Not applicable

Hi 
Please take a look at this article about how to convert columns to rows. 
Regards
Shong

lemufty
Contributor III
Contributor III
Author

hi shong,
i think that i'm not to express correctly. Correct topic is:how to transform row to column
i want to transform row to column.
i tried tunpivot and it don't work. sample example.i have columnName,columnValue 
"AccountNumber";"12235adssqq"
"AccountSubType__c";"bonjour"
"ActivityIdentificationCode__c";"bonsoirs"
"AsstEmail__pc";"kpk@gmail.com"
---------------------------------------
"AccountNumber";"12236ads"
"AccountSubType__c";"bonj"
"ActivityIdentificationCode__c";"bonsoir"
"AsstEmail__pc";"test@gmail.com"
 i want to have a columnName on only 1 row and other rows are columnValue . sample example:
"AccountNumber";"AccountSubType__c";"ActivityIdentificationCode__c;"AsstEmail__pc"
"12235adssqq";"bonjour";"bonsoirs";"kpk@gmail.com"
"12235ads";"bonj";"bonsoir";"test@gmail.com"
lemufty
Contributor III
Contributor III
Author

when i use tpivotColumnDelimited and  .i have this data file below.
0683p000009MB9u.png
 or i want to have the data file below
0683p000009MB9z.png
thank you
Anonymous
Not applicable

Hi
I think you don't tunpivot component correctly, you need to add a key column after you read the source data, for example:
"AccountNumber";"12235adssqq"
"AccountSubType__c";"bonjour"
"ActivityIdentificationCode__c";"bonsoirs"
"AsstEmail__pc";"kpk@gmail.com"
"AccountNumber";"12236ads"
"AccountSubType__c";"bonj"
"ActivityIdentificationCode__c";"bonsoir"
"AsstEmail__pc";"test@gmail.com"
becomes:
1;"AccountNumber";"12235adssqq"
2;"AccountSubType__c";"bonjour"
3;"ActivityIdentificationCode__c";"bonsoirs"
4;"AsstEmail__pc";"kpk@gmail.com"
1;"AccountNumber";"12236ads"
2;"AccountSubType__c";"bonj"
3;"ActivityIdentificationCode__c";"bonsoir"
4;"AsstEmail__pc";"test@gmail.com"
Below is an example showing how to add a new ID column with the values like 3,2,1,0 for every 4 lines.
0683p000009MAUf.png
Regards
Shong
lemufty
Contributor III
Contributor III
Author

thank you. it work well