Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
william_denholm
Contributor III
Contributor III

Selective loads from 2 QVDs

Hello,

I have two tables that I want to load information from but only where certain conditions are met. I only want those message type of Order_Confirmation and I want to match that to a second table to get the Status within the message.

ORDERS table

Message IDOrder IDMessage type
11001001Order_Confirmation
21001002Order_Confirmation
31001110Order_Cancellation

ORDER Lines table

Message IDOrder LineStatus
11Confirmed
12Confirmed
21Delayed

I want to match the order ID in ORDERS table with the Status in the ORDER Lines table.

The message IDs match, and I only want to take Order Line 1 from the order line table.

I've tried to do a concatenate load of the ORDER Lines table where the message type is Order_Confirmation and then use those Message IDs to load from the Order Lines table but that doesn't work.

LOAD MESSAGE_ID,

     ORDER_LINE,

     STATUS

FROM

[ORDER_LINES.qvd]

(qvd)

WHERE MATCH(ORDER_LINE, '1');

Concatenate LOAD

MESSAGE_ID

FROM

[ORDERS.qvd](qvd)

WHERE NOT EXISTS(MESSAGE_ID)

AND MATCH(MESSAGE_TYPE, 'ORDER_CONFIRMATION');

Any help would be gratefully appreciated.

2 Replies
MayilVahanan

Hi

Try like this

Message ID Message type Order ID Order Line Status
1Order_Confirmation10010011Confirmed
2Order_Confirmation10010021Delayed

OrdersTemp:

LOAD * Where WildMatch([Message type],'*Confirmation*');

LOAD * INLINE [

    Message ID, Order ID, Message type

    1, 1001001, Order_Confirmation

    2, 1001002, Order_Confirmation

    3, 1001110, Order_Cancellation

];

Left Join(OrdersTemp)

LOAD * INLINE [

    Message ID, Order Line, Status

    1, 1, Confirmed

    1, 2, Confirmed

    2, 1, Delayed

];

NoConcatenate

Order:

LOAD * Resident OrdersTemp Where [Order Line] = 1;

DROP Table OrdersTemp;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Gysbert_Wassenaar

I only want those message type of Order_Confirmation

Load * From [ORDERS table] Where [Message Type] = 'Order_Confirmation';

I want to match that to a second table to get the Status within the message

Load * From [ORDER Lines table];

The tables will be linked by the common field Message ID. So the Status will be associated with the correct orders.


talk is cheap, supply exceeds demand