Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
laurilahti
Contributor II
Contributor II

copy value from field to another until specific line of a new value is reached

I have dataset like this

TranID Line nr itemCode LineType
123 1 Gitem1 group
123 2 item12 inv
123 3 item34 inv
123 4 - endgroup
123 5 Gitem2 group
123 6 item55 inv
123 7 item6 inv
123 8 item5 inv
123 9 - endgroup
1235 1 Gitem12 group
1235 2 item12 inv
1235 3 item34 inv
1235 4 item76 inv
1235 5 - endgroup
1245 1 Gitem17 group
1245 2 item6 inv
1245 3 item8

inv

 

and I want a new field ItemGroup where is the group item of each line that it belongs too. 

So I basically want to add the itemcode (example Gitem1) of the LineType "group" to new field ItemGroup

to all the fields with the same TranID as long as LineType "endgroup" is reached. After that the next group's itemCode is added to the next lines to ItemGroup -field

TranID Line nr itemCode LineType ItemGroup
123 1 Gitem1 group Gitem1
123 2 item12 inv Gitem1
123 3 item34 inv Gitem1
123 4 - endgroup Gitem1
123 5 Gitem2 group Gitem2
123 6 item55 inv Gitem2
123 7 item6 inv Gitem2
123 8 item5 inv Gitem2
123 9 - endgroup Gitem2
1235 1 Gitem12 group Gitem12
1235 2 item12 inv Gitem12
1235 3 item34 inv Gitem12
1235 4 item76 inv Gitem12
1235 5 - endgroup Gitem12
1245 1 Gitem17 group Gitem17
1245 2 item6 inv Gitem17
1245 3 item8 inv Gitem17

 

 

Labels (1)
1 Solution

Accepted Solutions
DGO
Contributor III
Contributor III

I don't have the solution, but it seems you have a source data problem.  You're missing a header level id.  Is it possible to review the source to join in the header id?

View solution in original post

2 Replies
DGO
Contributor III
Contributor III

I don't have the solution, but it seems you have a source data problem.  You're missing a header level id.  Is it possible to review the source to join in the header id?

laurilahti
Contributor II
Contributor II
Author

The source does not provide that but if you mean line level id then it can be created from the compination of TranID & LineNr