Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

roccoxpecora
New 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

Tags (1)
3 Replies
oscarmqz
Contributor III

Re: Yes/No Flag in load script

Hello

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

Regards

MVP & Luminary
MVP & Luminary

Re: Yes/No Flag in load script

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!

Highlighted

Re: Yes/No Flag in load script

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