Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
serg_ysn
Contributor III
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
Peter_Cammaert

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;

View solution in original post

4 Replies
Peter_Cammaert

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;

View solution in original post

pokassov
Specialist
Specialist

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
Master II
Master II

u can follow pcammaert advice.

serg_ysn
Contributor III
Contributor III

Thank you for your help, very helpful