Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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
Contributor

Re: If Condition in Load Script

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

MVP
MVP

Re: If Condition in Load Script

Try something like

LOAD

     X,Y,

     col1 & '##' & col2 as _LoadKey,

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

     ...

vikasmahajan
Honored Contributor III

Re: If Condition in Load Script

Please try following syntax of  if statement

if ( <Condition> , Yes , No)

You are using if syntax wrong.

Regards

Vikas

Community Browser