Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

twanqlik
Contributor

Transpose rows to columns

I'm trying to transpose the following table:

Input:

  

%Classification_KeyAttributeIDValue%Table
de_DE_7PH-CATALOG-EOP2037-10-10
de_DE_7PH-CATALOG-PRD-AUDIENCEB2B
de_DE_7PH-CATALOG-PRD-CTNREGTE
de_DE_7PH-CATALOG-PRD-TARGETPRD-308941
de_DE_7PH-CATALOG-SOP2016-10-04
de_DE_7PH-IsActivetrue
de_DE_7PH-IsDeletedfalse
de_DE_7PH-IsEnabledtrue

Output:

       

PH-CATALOG-EOPPH-CATALOG-PRD-AUDIENCEPH-CATALOG-PRD-CTNPH-CATALOG-PRD-TARGETPH-CATALOG-SOPPH-IsActivePH-IsDeletedPH-IsEnabled%Classification_Key
2037-10-10B2BREGTEPRD-3089412016-10-04truefalsetruede_DE_7

I'm really struggling with this. How to do this in the scripting part, not on the front-end

1 Solution

Accepted Solutions

Re: Transpose rows to columns

6 Replies

Re: Transpose rows to columns

Highlighted
Partner
Partner

Re: Transpose rows to columns

You can check your options hereGroup by explanation‌ or here Multiple rows with different dimensions

AGB

Re: Transpose rows to columns

vamsee
Valued Contributor

Re: Transpose rows to columns

Hello,

I think you are looking for Generic Load

The GENERIC Load – QLIKIES

Generic LOAD

%Classification_Key,

AttributeID,

Value%Table

From Source;

twanqlik
Contributor

Re: Transpose rows to columns

It creates 1 table per field.

It can work on the front-end, but this is not what i'm searching for

twanqlik
Contributor

Re: Transpose rows to columns

Thanks, this worked:

Table:

LOAD * INLINE [

    ID, NAME, VALUE

    1, name1, val1

    1, name2, val2

    2, name1, val3

    2, name2, val4

    3, name1, val5

    3, name2, val6

    4, name1, val7

    4, name2, val8

    5, name3, val9

];

FinalTable:

LOAD Distinct ID

Resident Table;

FOR i = 1 to FieldValueCount('NAME')

LET vField = FieldValue('NAME', $(i));

Left Join (FinalTable)

LOAD ID,

VALUE as [$(vField)]

Resident Table

Where NAME = '$(vField)';

NEXT i

DROP Table Table;