Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Transform table in script

Hi everyone!

I have a table with the following structure:

table1

NumberNameText
1A-nameA1
1B-nameB1
1C-nameC1
2A-nameA2
2B-nameB2
2C-nameC2
3A-nameA3
3B-nameB3
3C-nameC3

Based on table1 I want to get the following table:

NumberA-nameB-nameC-name
1A1B1C1
2A2B2C2
3A3B3C3

My script:

table2:

Load Number,

if(Name = 'A-name', Text) as A-name,

if(Name = 'B-name', Text) as B-name,

if(Name = 'C-name', Text) as C-name

resident table1;

But unfortunately my result is following table:

table2

NumberA-nameB-nameC-name
1A1--
1-B1-
1--C1
2A2--
2-B2-
2--C2
3A3--
3-B3-
3--C3

Can anyone help me?

1 Solution

Accepted Solutions
Not applicable
Author

Not Sure, How you Followed the Miguel`s suggestion. I followed his suggetsion, i could get the proper result.

Check out the attached application.

-Sridhar

View solution in original post

4 Replies
Miguel_Angel_Baeyens

Hi,

If your model is not very big, you can try a generic load in the script, that will leave the data as you expect

Table:

GENERIC LOAD Number,

     Name,

     Text

FROM

C:\qcomGenericLoad.xlsx

(ooxml, embedded labels, table is Sheet1);

You can get that in the chart, creating a new pivot table, using Number and Name as dimensions and Text or Only(Text) as expression.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Not applicable
Author

Hi,

thanks for your answer.

I tried the generic load and it simplifies my script, but the result is still the same (like table2 in my example).

Not applicable
Author

Not Sure, How you Followed the Miguel`s suggestion. I followed his suggetsion, i could get the proper result.

Check out the attached application.

-Sridhar

Not applicable
Author

Sleepa, oops..!! My thread may be helpful Answer and Miguel Angel Baeyens post should be correct one.

Please dont mind to change the correct and helpful answer status

- Sridhar