Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
arsenal83
Contributor

Text string function

Hello,

I have column with partner ID and I would like to flag in my script partners with prefix ZD and the numer on the third place (ZD0, ZD3, ZD9 but without ZDQ).

any suggestions?

Luke

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Text string function

if(left([partner ID],2) = 'ZD' and match(right([partner ID],1),1,2,3,4,5,6,7,8,9,0), 'Yes','No') as flag

9 Replies
ramoncova06
Valued Contributor III

Re: Text string function

maybe something like

if(left(partner ID,3) <> 'ZDQ' and left(partner ID,2) = 'ZD', 'Yes','No') as ZDFlag

MVP
MVP

Re: Text string function

If( Left( ID, 2) = 'ZD' and isnum(mid( ID, 3,1)), 'Yes','No') as Flag

MVP
MVP

Re: Text string function

if(left([partner ID],2) = 'ZD' and match(right([partner ID],1),1,2,3,4,5,6,7,8,9,0), 'Yes','No') as flag

Re: Text string function

Just because I've always wanted to find a use for the "precedes" operator:

=TextBetween([Partner ID],'ZD','') precedes 'A'

-Rob

http://masterssummit.com

http://robwunderlich.com

MVP
MVP

Re: Text string function

..but watch out, help means precedes operator is using ASCII Comparison, but it's not:

= '9' precedes ':'    => false

but

= ord('9') < ord(':')  => true

So, my guessing is some other internal order is used.

Re: Text string function

another one:

IsNum(Num#(partnerID,'ZD0'))

hope this helps

regards

Marco

Re: Text string function

QlikCommunity_Thread_167635_Pic1.JPG

MVP
MVP

Re: Text string function

Unfortunately, this also accepts codes with second char being any number like:

=isNum(Num#('Z17','ZD0')) 

Probably because 'D' is a format code coincidentially.

Re: Text string function

'D1' also is flagged.

Maybe not the best solution after all

thanks

Marco

Community Browser