Justin Close Posted December 23, 2013 Posted December 23, 2013 OK, so here's another thing that I thought I knew, but apparently I had remembered my results wrong. Say you want to find something in a list of items like this: $value = 'apple'; $multiValue = 'orange¶apple¶banana' It was my recollection that you could use this statement: If ( $value = $multiValue ; 1 ; 0 ) to determine if the value 'apple' existed somewhere in the field or multi-value string/list. That doesn't appear to work, even if the value being checked for is the first value in the list. I would have sworn (I must swear a lot) that I had done this before. But apparently not, because it doesn't work. Instead I have resorted to using position(): If ( Position ( $multiValue ; $value ; 1 ; 1 ) > 0 ; 1 ; 0 ) Any other techniques for checking the existence of a value in a list? Something that is faster? Thanks, C
LaRetta Posted December 23, 2013 Posted December 23, 2013 Try: not IsEmpty ( FilterValues ( $Value ; $multiValues ) ) Position() can give false positives because it can match partial words.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now