Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
ester_pr
Partner - Creator
Partner - Creator

Join with if function in script

Hi,

I am trying to create a new field from 3 tables

my script is

Snif:load

Distinct  OvedTokefDeptKey,

SnifDept as SacarDept
,
OVEDSACAR as OVEDid

Resident SACAR;

left join LOAD Distinct [dip] as SacarDept,
    
[sub dip] as snif1
    
Resident Division; left join(Snif)

LOAD MIFAL as snif2
,
OVEDOVED  AS OVEDid

Resident Oved;


LOAD OvedTokefDeptKey,

OVEDid,IF(snif1<>0,snif1,snif2) AS SNIF

Resident Snif;

DROP Table Snif;

is there any oter way?

thanks,

Ester

Labels (1)
1 Reply
Not applicable

The Below code should work.

Snif:

Load *,
IF(snif1<>0,snif1,snif2) AS SNIF
;

load Distinct
OvedTokefDeptKey,
SnifDept as SacarDept
,OVEDSACAR as OVEDid

Resident SACAR;

left join LOAD Distinct [dip] as SacarDept,
     [sub dip] as snif1
     Resident Division; left join(Snif)

LOAD MIFAL as snif2
,OVEDOVED  AS OVEDid

Resident Oved;