Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Generic load with two dimensions?

Hello,

I've previously done generic loads as described here: The GENERIC Load – QLIKIES

However, in my current project I am required to transform table 1 below, into table 2. I'm unable to achieve this with the standard generic load statement, as there are two dimensions (Definition and Time). Are there any other ways to achieve this transformation?

Table 1:

KeyDefinitionTimeResult
1Weight1/1/2017 1:0054
1Weight1/2/2017 1:0050
1Blood pressure1/1/2017 1:0080
1Blood pressure1/1/2017 13:0068
1Blood pressure1/2/2017 1:0070
1Heart Rate1/1/2017 1:0068
1Heart Rate1/2/2017 1:0054
2Weight1/15/2017 4:0078
2Blood pressure1/15/2017 4:0087
2Blood pressure1/16/2017 4:0090
2Blood pressure1/17/2017 4:0084
2Blood pressure1/18/2017 4:0083
2Heart Rate1/15/2017 4:0088

Table 2:

KeyWeightBlood PressureHeart RateTime
15480681/1/2017 1:00
1-68-1/1/2017 13:00
15070541/2/2017 1:00
27887881/15/2017 4:00
2-90-1/16/2017 4:00
2-84-1/17/2017 4:00
2-83-1/18/2017 4:00

hic

6 Replies
rubenmarin

Hi Manas, one easy way seems to create a composite key using both fields, so you end with only one key and you can apply the usual solution, you can split it later using subfield():

LOAD Key&'#'& Time as CompositeKey,

     ....

LOAD Subfield(CompositeKey, '#', 1) as Key,

     Subfield(CompositeKey, '#', 2) as Time,

  ...

Anil_Babu_Samineni

I wonder, Why this need script i meant to say while load. One front end solution may be this?

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anil_Babu_Samineni

Are you sure, by help of Composite key can we achieve this? If so, Can you help me to create script. I've done something like this.

LOAD *, SubField(CKey, '#', 1) as Key, SubField(CKey, '#', 2) as Time;

LOAD Definition, Key & '#' & Time as CKey, Result

FROM ...;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
antoniotiman
Master III
Master III

Hi Manas,

Generic
LOAD Key,Time,
Definition,Result
FROM
"https://community.qlik.com/message/1303333"
(html, codepage is 1252, embedded labels, table is
@1);

Regards,

Antonio

rubenmarin

Hi Anil, I didn't tried but the link on the first post (The GENERIC Load – QLIKIES) seems a working way to do the table using generic load.

The composite key should be like the TransID field in the 'Clean-up' section, and the key split can be done after the last "for", when the KEY table is already created with all the values.

Anil_Babu_Samineni

True, The clean-up solution should work when simple data set. Even though, Simple Generic won't work for this because when source is Excel or any other DB. That is where i recommend him to do in UI itself. Let's see if Henric offers or not?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful