Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

salto
Valued Contributor II

Table transformation

Hello Community!

I have a table like this:

RowFormula
BS0500BS0510
BS0500BS0520
BS0510240
BS0510249
BS0510293
BS0520242
BS0520295

And I would like to convert / expand it to this:

Header 1Header 2
BS0500240
BS0500249
BS0500293
BS0500242
BS0500295
BS0510240
BS0510249
BS0510293
BS0520242
BS0520295

Any help would be highly appreciated!

Thanks in advance.

Tags (2)
1 Solution

Accepted Solutions
Not applicable

Re: Table transformation

Hi, you can try this in the script -

HTH!

tab:

load * Inline [

_Row, Formula

BS0500, BS0510

BS0500, BS0520

BS0510, 240

BS0510, 249

BS0510, 293

BS0520, 242

BS0520, 295

];

Tmp:

load _Row, Formula as _F

resident tab;

left join

load

_Row as _F, Formula

Resident tab;

drop table tab;

Fnl:

load _Row as Row,

  if(isnull(Formula), _F, Formula) as Formula

resident Tmp;

drop table Tmp;

2 Replies
Not applicable

Re: Table transformation

Hi, you can try this in the script -

HTH!

tab:

load * Inline [

_Row, Formula

BS0500, BS0510

BS0500, BS0520

BS0510, 240

BS0510, 249

BS0510, 293

BS0520, 242

BS0520, 295

];

Tmp:

load _Row, Formula as _F

resident tab;

left join

load

_Row as _F, Formula

Resident tab;

drop table tab;

Fnl:

load _Row as Row,

  if(isnull(Formula), _F, Formula) as Formula

resident Tmp;

drop table Tmp;

salto
Valued Contributor II

Re: Table transformation

Thanks a lot Patrick!

Community Browser