Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Populate missing data by Iterating through a hierarchy

Hi all,

I have the following table below. The right-most columns is the required result. I have a sort of hierarchy, a child part that links to a parent part. I have Department (Dept) data for both child and parent. However a lot of this data is missing. In the expected result column I need to associate a Department with every Child Part.

There are the three possible scenarios (refer to left-most column for scenario number):

1. if 'Child Dept' is available.. then return 'Child Dept'.

2. if 'Child Dept' is not available but parent department is available... then return parent department.

3. This is the challenge!! If both child and parent department are missing.... look for the Parent part in the Child Part column and keep iterating until a Parent Part with a Parent Dept is found. In this case Part A is related to E in the hierarchy, and E belongs to department 100. Thus I want A to be linked with department 100.

Part of he problem is that one child part can be related to multiple parents parts as in the case of part B.

ScenarioChild PartParent PartChild DeptParent DeptExpected Result
1FG066110066
2HI-077077
3AB--100
3BC--100
3BD--100
3DE-100100

Is this achievable within the script? I think it should involve some iterations/looping.

Any help is appreciated. Thanks

1 Reply
adamdavi3s
Master
Master

Hi,


It is worth a browse of this document to see if anything useful pops out!

Generating Missing Data In QlikView

If not then as you say, this should be possible by some method

Please remember to mark this as helpful or the correct answer if I have helped you or answered your question.