Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Find string in a string??
Sat, Mar 20 2021 8:15 PMPermanent Link

Ian Branch

Avatar

Hi Team,
How do I find/test if a field called Status has its value contained in a string like 'CA;CO;CL'?
IN won't work, it wants something like ('CA',CL','CO'). Frown
CONTAINS is no good.

Regards & TIA,
Ian
Sat, Mar 20 2021 8:20 PMPermanent Link

Ian Branch

Avatar

Yeah!  Isn't always the way....
As soon as I raised the Question I came across Occurs().
Sigh!

All good now.

Thanks for looking.
Ian
Sun, Mar 21 2021 8:19 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


For future reference I use POS.

Roy Lambert
Sun, Mar 21 2021 3:45 PMPermanent Link

Ian Branch

Avatar

Noted.  I didn't get that far in the alphabet.  Wink
Mon, Mar 22 2021 3:22 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian

Couple of things:


Whilst I doubt you'd notice any speed difference with the length of string you're liable to be using, and unless its hitting loads of rows remember POS returns as soon as it finds a hit, OCCURS has to check out the full string every time

Second whichever way you go, unless you can guarantee uniqueness of substrings in the string always append the separator to the row you're testing

silly case test for 'co' in 'coa;cob;coc' would show true but test for 'co;' and it will return false

I been bitten by that a few times.

Roy Lambert
Mon, Mar 22 2021 2:49 PMPermanent Link

Ian Branch

Avatar

Hi Roy,
Noted.  Fortunately they are all unique.

Regards,
Ian
Image