Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Yes/No Flag in load script

Hey everyone,

So I have a field called order type and I want to take the last two characters of the values that have "BD", and make a Yes/No bucket or a BD Flag dimension with values Y and N.

So something like

If(OrderType='BD','Y','N')

But I know I'm missing the part that specifies BD as the last two characters.

Thanks

Rocco

3 Replies
Anonymous
Not applicable
Author

Hello

if(right(OrderType,2)='BD','Y','N')

Regards

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

the function you are looking for is Right(). Also, I recommend defining a numeric flag, instead of alphanumeric. Your expressions with the flag will be much more efficient:

If(Right(OrderType, 2)='BD',1,0)


cheers,


Oleg Troyansky

www.masterssummit.com - take your QlikView skills to the next level!

MarcoWedel

Hi,

one possible solution could be also:

LOAD *,

    If(OrderType like '*BD',Dual('Y',-1),Dual('N',0)) as [BD Flag]

Inline [

OrderType

GHIJKLBDMNOPQRST

ABHIJKLMNOPXYZBD

BCDEFGOPQRYZ

DEFGTUVWXYZ

DEFGHIJKLQRSYZ

DEFMNSTUVWXBD

FGHIJKLMNOPQRSTUV

CDEFGHIJKLMNOUBD

BDEFGHIJKLMWXYZ

GHIJKLMNOPQRSTUBD

CDEFGHIJKLMNOPQRXYZ

FGHIBDLMNOPQRSTUVWZ

]

Creating dual values allows you to use the BD Flag field e.g. like this:

QlikCommunity_Thread_165105_Pic1.JPG

QlikCommunity_Thread_165105_Pic2.JPG

hope this helps

regards

Marco