Qlik Community

Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

Not applicable

Transposer des tables

Bonjour,

je travail sur une base avec des tables construite en colonne ( ~200)

est il possible en script de passer d'une table

a une table comme celle ci

Merci

1 Solution

Accepted Solutions

Re: Transposer des tables

Try this:

Table:

CrossTable(Header, Value, 2)

LOAD ID,

  IDwagon,

  NomDechet01&'|'&ValDechet01,

  NomDechet02&'|'&ValDechet02,

  NomDechet03&'|'&ValDechet03;

LOAD * INLINE [

    ID, IDwagon, NomDechet01, NomDechet02, NomDechet03, ValDechet01, ValDechet02, ValDechet03

    75524, 74752, Fentes, Pli / para creve, Terre dure / corps etranger, 0, 11, 6

    75525, 74753, Fentes, Pli / para creve, Terre dure / corps etranger, 0, 1, 0

    75526, 74754, Fentes, Pli / para creve, Terre dure / corps etranger, 1, 3, 1

    75527, 74755, Fentes, Pli / para creve, Terre dure / corps etranger, 0, 0, 0

];

FinalTable:

LOAD ID,

  IDwagon,

  SubField(Value, '|', 1) as Type,

  SubField(Value, '|', 2) as Valeur

Resident Table;

DROP Table Table;


Capture.PNG

2 Replies

Re: Transposer des tables

Try this:

Table:

CrossTable(Header, Value, 2)

LOAD ID,

  IDwagon,

  NomDechet01&'|'&ValDechet01,

  NomDechet02&'|'&ValDechet02,

  NomDechet03&'|'&ValDechet03;

LOAD * INLINE [

    ID, IDwagon, NomDechet01, NomDechet02, NomDechet03, ValDechet01, ValDechet02, ValDechet03

    75524, 74752, Fentes, Pli / para creve, Terre dure / corps etranger, 0, 11, 6

    75525, 74753, Fentes, Pli / para creve, Terre dure / corps etranger, 0, 1, 0

    75526, 74754, Fentes, Pli / para creve, Terre dure / corps etranger, 1, 3, 1

    75527, 74755, Fentes, Pli / para creve, Terre dure / corps etranger, 0, 0, 0

];

FinalTable:

LOAD ID,

  IDwagon,

  SubField(Value, '|', 1) as Type,

  SubField(Value, '|', 2) as Valeur

Resident Table;

DROP Table Table;


Capture.PNG

Not applicable

Re: Transposer des tables

Thank you very much for the response that corresponds entirely to what I wanted to do

Community Browser