Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
serg_ysn
New Contributor III

How to make 2 tables from one

All good health

There are table describes the article and sub

structure:

The foreign key Name, Internal key

If the internal key is null, it is article,

if the internal key is not null, it is a subarticle

How to make two lists Article and subarticle?

the example table

PaymentTypeId ; Name ; ParentId

-1 ; System ; null

0 ; Depositing ; -1

1 ; Payment document ; -1

10 ; Manager ; null

11 ; Receipts ; 10

12 ; Documents ; 10

1 Solution

Accepted Solutions

Re: How to make 2 tables from one

For example, these two LOAD statements separate articles from subarticles but keep their relations...

Articles:

LOAD PaymentTypeId AS ArticleId, Name AS ArticleName

FROM YourDataSource

WHERE len(trim(ParentId)) = 0;

SubArticles:

LOAD ParentId AS ArticleId, PaymentTypeId As SubArticleId, Name As SubArticleName

FROM YourDataSource

WHERE len(trim(ParentId)) > 0;

4 Replies

Re: How to make 2 tables from one

For example, these two LOAD statements separate articles from subarticles but keep their relations...

Articles:

LOAD PaymentTypeId AS ArticleId, Name AS ArticleName

FROM YourDataSource

WHERE len(trim(ParentId)) = 0;

SubArticles:

LOAD ParentId AS ArticleId, PaymentTypeId As SubArticleId, Name As SubArticleName

FROM YourDataSource

WHERE len(trim(ParentId)) > 0;

pokassov
Valued Contributor

Re: How to make 2 tables from one

or instead of

Where len(trim(ParentId)) = 0


we can use this condition for Articles

Where IsNull(ParentId)


and for SubArticles:

Where Not IsNull(ParentId)

buzzy996
Honored Contributor II

Re: How to make 2 tables from one

u can follow pcammaert advice.

serg_ysn
New Contributor III

Re: How to make 2 tables from one

Thank you for your help, very helpful