Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On May 18th at 10AM EDT we will answer your QlikView questions live. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
roccoxpecora
Contributor III
Contributor III

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
oscarmqz
Creator III
Creator III

Hello

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

Regards

Oleg_Troyansky

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