Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help to build a table by script

Hi guys,

I need help.

I have a table with two fields "ID" and "CHILD".

For instance.

ID    CHILD

1    2

2    3

3    147

147    149

236    237

237    242

242   

344    345

I'd like to build another table like that:

LIV1    LIV2    LIV3    LIV4    LIV5    LIV6    LIV7    ...    LIV12

1    2    3    147    149

236    237    242

344    345

ID and CHILD It's like a tree. I have to follow every main branch of the tree.

hope it's clear.

I attach a file with the initial table.

Any idea to solve my problem?

Best regards

Giampiero

1 Solution

Accepted Solutions
swuehl
MVP
MVP

This should at least create the hierarchy tree view in your list box.

Hope this helps,

Stefan

View solution in original post

7 Replies
swuehl
MVP
MVP

You can look into the HIERACHY LOAD prefix, maybe like

HIERARCHY(CHILD, ID, ID_Name) LOAD ID_Name,

     ID,

     PARENT,

     CHILD,

     NEXTN

FROM

[table.xls]

(biff, embedded labels, table is [initial table$]);

Not applicable
Author

Hi,

thanks for your reply.

I already tried with HIERARCHY but unfortunately it doesn't seem to help me.

It doesn't build the hierarchy like I need to.

Any other idea

Many thanks

regards

Giampiero

swuehl
MVP
MVP

As far as I remember, it should return a table like you requested above, but I think it will eventually return more records than you need, so you may want to remove some of them afterwards. That means, the table will create one record per input record, including all parents (complete path to ID).

HIERARCHY (ID, PARENT, ID_Name )

LOAD ID as ID_Name,

     ID,

     PARENT

FROM

[table.xls]

(biff, embedded labels, table is [initial table$]);

Not applicable
Author

Hi,

I did exactly the same (I attach my file).

Unfortunately the hierarchy is not readable.

I mean there are lots of rows in my pivot table that are not useful for me and don't allow to understand the hierarchy.

Any idea about it.

Many thanks

Giampiero

Not applicable
Author

Sorry the attach file 🙂

swuehl
MVP
MVP

This should at least create the hierarchy tree view in your list box.

Hope this helps,

Stefan

Not applicable
Author

Hi Stefan,

THANK YOU SO MUCH.

It works.

Giampiero