Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

demoustier
Contributor

Table rotation in the script

Good day,

I have a table as below:

 

NameTypeCount
XA1
XB2
YA3
YC4
ZA5
ZC6
ZD7

and I need to have a transposed table generated by the script as below:

 

NameABCD
X12
Y3 4
Z5 6

7

In other word, I need to define, in the script, the name of a field by a formula.

Do you think it's possible ?

Any idea ?

Kind regards

1 Solution

Accepted Solutions
Not applicable

Re: Table rotation in the script

Try this,

Test:

Generic

Load * Inline

[

  Name, Type, Count

  X, A, 1

  X, B, 2

  Y, A, 3

  Y, C, 4

  Z, A, 5

  Z, C, 6

  Z, D, 7

];

NoConcatenate

Test_Temp:

Load *

Resident Test.A;

Join(Test_Temp)

Load *

Resident Test.B;

Join(Test_Temp)

Load *

Resident Test.C;

Join(Test_Temp)

Load *

Resident Test.D;

DROP Tables Test.A,Test.B,Test.C,Test.D;

7 Replies

Re: Table rotation in the script

Generic

Load * Inline

[

  Name, Type, Count

  X, A, 1

  X, B, 2

  Y, A, 3

  Y, C, 4

  Z, A, 5

  Z, C, 6

  Z, D, 7

];

ggallina
Contributor III

Re: Table rotation in the script

Hi,

why you want to do this in the script?

Isnt better to do in a pivot table in QlikView?

Regards.

ggallina
Contributor III

Re: Table rotation in the script

If you import a Excel file you cando this:

Directory;
LOAD F2,
     F3,
     F5,
     F7,

FROM
[..\External Data\test.xls]
(biff, embedded labels, table is A$, filters(
Transpose(),
Transpose(),
Transpose()
));

Have a look for the second step of importation:

Regards.

demoustier
Contributor

Re: Table rotation in the script

Hi,

I need to export the result by .qvd, it's why I want it in the script (unless there is a possibilties to export a pivot table into .qvd ???)

Unfortunately, the source is not an Excel but directly from a data base

Not applicable

Re: Table rotation in the script

Try this,

Test:

Generic

Load * Inline

[

  Name, Type, Count

  X, A, 1

  X, B, 2

  Y, A, 3

  Y, C, 4

  Z, A, 5

  Z, C, 6

  Z, D, 7

];

NoConcatenate

Test_Temp:

Load *

Resident Test.A;

Join(Test_Temp)

Load *

Resident Test.B;

Join(Test_Temp)

Load *

Resident Test.C;

Join(Test_Temp)

Load *

Resident Test.D;

DROP Tables Test.A,Test.B,Test.C,Test.D;

demoustier
Contributor

Re: Table rotation in the script

Wooww !!!!

it's works !!!!

What does it means "Resident Test.B" ???

Not applicable

Re: Table rotation in the script

Please refer the link for more drtails about generic load.

The Generic Load

Regards,

Sindhu Kannan.

Community Browser