Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Column name need for each row

hi all

i have data like attached below

Col1col2col3col4col5col6col7col8col9col10
a1x4d7gxyzaa0
b2y5e8hxyzbb0
c3z6f9ixyzcc0

in script level  itself i need to convert my data like i attached below

Col1col2col3col4col5col6col7col8col9col10
a1x4d7gxyzaa0
Col1col2col3col4col5col6col7col8col9col10
b2y5e8hxyzbb0
Col1col2col3col4col5col6col7col8col9col10
c3z6f9ixyzcc0

any idea!!!!

thanks

13 Replies
sujeetsingh
Master III
Master III

just reload the table once stacked with loading 1 st row then 2nd row ......etc

Or just do a trick of concatenating more than one table

Not applicable
Author

hi sujeet,

thanks alot for ur kind reply.

will u plz explain me a bit detailed please

thnx

Not applicable
Author

Hi ,

Like this

Qualify *;

Table1:

Loald *

From YourSource

Where Col1='a';

Table2:

Loald *

From YourSource

Where Col1='b';

Table3:

Loald *

From YourSource

Where Col1='c';

UnQualify *;

Note: If you don't use Qualify, Auto concatenation will happen.

         If you use noConcatenate, Synthetic keys will create in your model.

Hope it helps you..!

Not applicable
Author

hi ravi,

i cant use where col1='a' somthing like that. because it may be anything and of i have 100000 rows i cant do one by one rite.

please suggest is thr any other way to achieve my desired result

thnx

sundarakumar
Specialist II
Specialist II

Pls explain..

Are Col1,col2,col3.... field names?

IF Col1, col2,... are field names, do u want the field name to be long with data in the alternate rows? or u want to have different tables with the fileds col1, col2,... with only one row each.?

If so y do u need it in that format? How are u planning to show data with the field names inside the data.

Or

are these col1, col2... are just data?

-Sundar

Not applicable
Author

hi sundar,

col1, col2, col3 are field name

do u want the field name to be long with data in the alternate rows?


Yes i need to show field name infront of each and every row

sundarakumar
Specialist II
Specialist II

Y so? How are u planing to show data in the dashboard with the field names mingled in along with the data.?

What would be the purpose of inserting the field names into the data? can u pls explain

-sundar

sundarakumar
Specialist II
Specialist II

Ur requrirementr can be done with a for loop and cancatenation.

This could be dont in the following way.

1. create a new key in the table as below
  rowno() as newkey

table1:
load col1,col2,
rowno() as newkey

from source;


2.now create an inline table with the same field names, but the data as the field names itself.

table2:
load * inline
[col1,col2,newkey
col1,col2,newkey];

3.now load only one row of data from table 1 and concatenate to table2
4.concat table2
5.load the second row from table1 and concatenate to table2
6. concat table2

7. for loop can be written to repeat 3,4,5,6,....

8. after loading it in the desired format, drop table1.

Hope this helps.

-Sundar

Not applicable
Author

hi sundar,

thnk u very much for ur reply. i am very new to qlikview. will you please share me the script. how exactly we can do it..

thnaks