Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jfadderholdt
Contributor II
Contributor II

How to read data with overlapping header and detail lines

I need to read in data that has overlapping header and detail lines. The header key does not appear on the detail lines and the number of detail lines is variable. One of the header line data elements appears directly over a corresponding related value in the detail line. Each group is separated by blank row. Attached is an Excel file of the input and the desired output. How do I read this data and associate the detail with the correct header information? Any suggestions?

1 Reply
jfadderholdt
Contributor II
Contributor II
Author

OK. Here's an update and answer. I can tell from the number of people who have viewed this question without an answer, that the request to have 2 different retained data values in columns B, Item and Loc, and column G, Source and Entry Date poses a real problem.

I needed to press on with the project, so I kept pouring through my books etc, and found an answer. In my actual data, I found a second column containing the Entry Date equivalent that did not have an overlapping header value that I needed to retain. I also found another way to collect the Loc data with an additional step. So I devised a solution making the best use of the data I could glean from the presented data source.

The easiest answer is using the Fill function within the File Wizard in QlikView. I used the Fill function to match the longer value in column B and filling it with the "above" value, until the next occurrence of a header value. I did the same to fill the proper values in column D. And it did the same for Column G and overlaid the header value for each detail line, and then found, as I said before, another source for the date information that was overlaid. So Fill works well. Check it out. What is interesting is the resulting code has code like

filters(

Replace(1, top, StrCnd(start, '1')),

Replace(5, top, StrCnd(null)),

Replace(10, top, StrCnd(start, '4'))

));  at the end of the From file statement. That's how the fill functionality accomplishes the transformation. Pretty cool.