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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Chris1662
Contributor
Contributor

Load data with condition

Hello Qlik Community,

In my table I have a Parent_ID, a CHILD_ID and a Description field, as example:

PARENT_ID CHILD_ID DESCRIPTION
10 1 Description 1
10 2 Description 2
10 3 Description 3
  10 Description 1
  10 Description 2
  10 Description 3

I want to load the CHILD_IDs with their matching PARENT_IDs and the matching Descriptions. The problem is that the PARENT_ID is also listed in the CHILD_ID Field since the PARENT_ID for the CHILD_IDs 1,2,3 can be the CHILD_ID to another PARENT_ID. My Problem is that I only want to see the descriptions for a CHILD_ID if there is only one Description for this ID because in this example the field description for the CHILD_ID 10 would contain all description for the CHILD_IDs of the PARENT_ID 10. My two ideas were: 1)To only load the data for the description field if there is only one entry or 2) only load the description field if the CHILD_ID does not exist in the PARENT_ID column. My problem is that I dont know how to implement idea 1) or 2) in the data load editor and which idea is better.

I hope my problem got clear and thanks for your help,

Regards Chris.

Labels (5)
1 Reply
hic
Former Employee
Former Employee

I would do it a different way. I would use ALL descriptions, concatenated using Concat(). Then I would load it using the Hierarchy prefix:

Data:
Hierarchy (CHILD_ID, PARENT_ID, Node, Parent, Node, Path, '/', Depth)
Load
CHILD_ID,
CHILD_ID as Node,
MinString(PARENT_ID) as PARENT_ID,
Concat(distinct DESCRIPTION,',') as DESCRIPTION
Resident SourceData
Group By CHILD_ID;

Henric_Cronstrm_0-1650961402105.png

See also https://community.qlik.com/t5/Qlik-Design-Blog/Unbalanced-n-level-hierarchies/ba-p/1474325