Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If Condition in Load Script

Hi All,

I need to create a Flag (1 or 0) by checking my _LoadKey value

For example my key value is like this:

if(123##) then 1

if(##232) then 1

if(112##234) then 0

if(##) then 1

I have one key by combaining the coln1 and coln2 like this,

col1 &'##'& col2 as _LoadKey   in Fact Table

and in LoadData table i have the same key

col1 &'##'& col2 as _LoadKey   in Fact Table

Now i'm doing inner join with Fact,

Like this

Fact:

Load A,B,

col1 &'##'& col2 as _LoadKey

From Fact.qvd

inner Join

Load X,Y,

col1 &'##'& col2 as _LoadKey ,

I need to create that flage condition here ( I wrote some thing like this

 

if

(FindOneOf( SALES_DATE &'##'& STORE_KEY,' '),1,0) as LoadFlag ) but it's not working

From LoadLog.qvd

Thanks,

Selva

3 Replies
vivek_niti
Partner - Creator
Partner - Creator

Hi,

try this code...

tab1:

LOAD * INLINE [

    F1

    123ABC456

    ABC123

    456ABC

    12ABCDEF

    ABC

];

tab2:

NoConcatenate

LOAD F1,

           If(WildMatch(F1,'*ABC','ABC*','ABC'),1,0) AS flag

RESIDENT tab1;

DROP TABLE tab1;

Vivek

swuehl
MVP
MVP

Try something like

LOAD

     X,Y,

     col1 & '##' & col2 as _LoadKey,

     if( len(trim(col1)) and len(trim(col2)), 0,1) as LoadFlag,

     ...

vikasmahajan

Please try following syntax of  if statement

if ( <Condition> , Yes , No)

You are using if syntax wrong.

Regards

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.