Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
salto
Specialist II
Specialist II

Table transformation

Hello Community,

I would like to transform this data table:

Header 1Header 2
BS001BS002
BS001BS003
BS002BS004
BS002246
BS003BS005
BS003BS006
BS005247
BS005248
BS004249
BS004250
BS006251
BS006252
BS006253

onto this one:

Header 1Header 2
BS001249
BS001250
BS001246
BS001247
BS001248
BS001251
BS001252
BS001253
BS002249
BS002250
BS002246
BS003247
BS003248
BS003251
BS003252
BS003253
BS004249
BS003250
BS005247
BS005248
BS006251
BS006252
BS006

253

Any help will be highly appreciated,

1 Solution

Accepted Solutions
salto
Specialist II
Specialist II
Author

Hi,

I found a solution very very near to what I need, via HierarchyBelongs to:

AccSched:

load

  [Header 1] as RowNo,

  'Desc' as DescriptionID,

  [Header 2]as GLAccount

  //SubField(Totaling, '+') as GLAccount,

  //[Totaling Type] as TotalingType2

from

[http://community.qlik.com/thread/115573]

(html, codepage is 1252, embedded labels, table is @1);

BomAccSchedTmp:

HierarchyBelongsTo (GLAccount, RowNo, DescriptionID, AncestorID, AncestorName, Depth)

LOAD

GLAccount,

RowNo,

DescriptionID

RESIDENT AccSched;

noconcatenate

BomAccSched:

LOAD * resident BomAccSchedTmp where Depth >0;

drop table BomAccSchedTmp;

Regards!

View solution in original post

3 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Data:

LOAD DISTINCT

  [Header 1]

FROM

[http://community.qlik.com/thread/115573]

(html, codepage is 1252, embedded labels, table is @1);

LEFT JOIN

Data:

LOAD DISTINCT

  [Header 2]

FROM

[http://community.qlik.com/thread/115573]

(html, codepage is 1252, embedded labels, table is @1)

WHERE IsNum([Header 2]);

Regards,

Jagan.

salto
Specialist II
Specialist II
Author

Hello Jagan,

sorry, I marked your answer as correct but unfortunately it is not.

Your proposal concatenates all Header2 to Header1, but the goal is to concatenate only those Header2 that "depend" from Header1.

For example, BS006 only has 251, 252 and 253.

How could I do this?

Thanks

salto
Specialist II
Specialist II
Author

Hi,

I found a solution very very near to what I need, via HierarchyBelongs to:

AccSched:

load

  [Header 1] as RowNo,

  'Desc' as DescriptionID,

  [Header 2]as GLAccount

  //SubField(Totaling, '+') as GLAccount,

  //[Totaling Type] as TotalingType2

from

[http://community.qlik.com/thread/115573]

(html, codepage is 1252, embedded labels, table is @1);

BomAccSchedTmp:

HierarchyBelongsTo (GLAccount, RowNo, DescriptionID, AncestorID, AncestorName, Depth)

LOAD

GLAccount,

RowNo,

DescriptionID

RESIDENT AccSched;

noconcatenate

BomAccSched:

LOAD * resident BomAccSchedTmp where Depth >0;

drop table BomAccSchedTmp;

Regards!