Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ajsjoshua
Specialist
Specialist

Linking tables using condition

Dear all,

I have a table called OCRT which has a field U-Export.

If U-Export=Y

then the table OCRT has to be linked with the table OCRD by the link field Cardcode in both these tables.

then the OCRD table has to be linked to the table CQ-RTSM by the link fields U-ATBeatcode in OCRD with U-Routcode in CQ-RTSM

and

If U-Export=N

then the table OCRT has to be linked with the table OCRD by the link field Cardcode in both these tables.

then the OCRD table has to be linked to the table CQ-RTSM by the link fields U-Beatcode in OCRD with U-Routcode in CQ-RTSM

My expected output is

customername  Beatname    collection

aaa                    sandy          2300

aaa                    barany        1500

bbb                    reddy          2311

bbb                    selv              763

ccc                    askar            123

ddd                    Richy          5400

PFA for sample app.

Regards,

Joshua.

1 Reply
niclaz79
Partner - Creator III
Partner - Creator III

Temp:

LOAD

cardcode,     

[U-Export],    

collection

FROM

[OCRT.xlsx] (ooxml, embedded labels, table is Sheet1);

Left Join(Temp)

LOAD

  cardcode,     

customername,     

[U-ATBeatcode] as Routcode_at,     

[U-Beatcode] as Routcode_beat

FROM

[OCRD.xlsx] (ooxml, embedded labels, table is Sheet1);

OCRDandOCRT:

NoConcatenate

LOAD

*,

if([U-Export] = 'Y', Routcode_at, Routcode_beat) as %Link

Resident Temp;


drop table Temp;


CQRTSM:

LOAD

*,

[U-Routcode] as %Link

FROM

[CQ-RTSM.xlsx]

(ooxml, embedded labels, table is Sheet1);