Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Problem Transforming Data

Hi

I have this format of input data. Which has a Header rows and Detail rows.  It comes in this order and also has a Row number to sort the data if needed.

Row Description Type Value
1HAHeader
2aDetail1
3bDetail2
4cDetail3
5dDetail4
6HBHeader
7eDetail5
8HCHeader
9fDetail6
10gDetail7
11hDetail8
12iDetail9


And I would like to transform it into this format, such that the the Header Description is repeated until a new Header.

Row Header Detail Value
1HAHA
2HAa1
3HAb2
4HAc3
5HAd4
6HBHB
7HBe5
8HCHC
9HCf6
10HCg7
11HCh8
12HCi9

I thought it would be easy but have completely failed.

Any suggestions ?

****************************************************************

Here is an inline load to create the input data

InputData :

LOAD * INLINE [

    Row, Description, Type, Value

    1, HA, Header

    2, a, Detail, 1

    3, b, Detail, 2

    4, c, Detail, 3

    5, d, Detail, 4

    6, HB, Header

    7, e, Detail, 5

    8, HC, Header

    9, f, Detail, 6

    10, g, Detail, 7

    11, h, Detail, 8

    12, i, Detail, 9

];

1 Solution

Accepted Solutions
MarcoWedel

Hi,

one solution could be:

QlikCommunity_Thread_143238_Pic1.JPG.jpg

LOAD Row,

    If(Type='Header', Description, Peek(Header)) as Header,

    Description as Detail,

    Value

FROM [http://community.qlik.com/thread/143238] (html, codepage is 1252, embedded labels, table is @1);

hope this helps

regards

Marco

View solution in original post

3 Replies
MarcoWedel

Hi,

one solution could be:

QlikCommunity_Thread_143238_Pic1.JPG.jpg

LOAD Row,

    If(Type='Header', Description, Peek(Header)) as Header,

    Description as Detail,

    Value

FROM [http://community.qlik.com/thread/143238] (html, codepage is 1252, embedded labels, table is @1);

hope this helps

regards

Marco

Anonymous
Not applicable
Author

Marco

Many thanks, that works perfectly.

Bill

MarcoWedel

You're welcome

regards

Marco