Hello!
I am trying to figure out how to add more than one option for CONTAINS.
Here is what I currently have, I definitely have a very low understanding of the logic for formulas:
CONTAINS([Day Notes], โcrockโ ) CONTAINS([Day Notes], โusbโ) CONTAINS ([Day Notes], โtradeโ)
It doesnโt need to contain all phrases, just one or the other or multiple. Iโm using this for a format rule.
Thanks in advance
Solved! Go to Solution.
@WillA108
Do you want
OR(CONTAINS([Day Notes], โcrockโ ),([Day Notes] = โusbโ), ([Day Notes]= โcoolerโ))
or this
OR(CONTAINS([Day Notes], โcrockโ ),CONTAINS([Day Notes], โusbโ),CONTAINS([Day Notes],โcoolerโ))
NOT TESTED
I removed the extra parenthisis before the second CONTAINS and a space. Does that still work?
Hi @WillA108
Check out OR()
For reference:
Yah I took a look at this, I still canโt figure out how to combine OR with CONTAINS.
Can you please give an example of how to give multiple options in a CONTAINS expression?
Thanks โค๏ธ
Iโve tried CONTAINS([Day Notes], โcrockโ ) OR (โusbโ) OR (โcoolerโ)
and i have tried CONTAINS([Day Notes], โcrockโ ) OR CONTAINS([Day Notes], โusb")
Also CONTAINS([Day Notes], โcrockโ ) OR ([Day Notes], โusbโ)
and also CONTAINS([Day Notes], โcrockโ OR โusbโ OR โcoolerโ)
I appreciate the responses but this is really all greek to me, as it doesnโt show me how to combine it with CONTAINS.
For example I tried CONTAINS([Day Notes], โcrockโ )OR([Day Notes] = โusbโ), ([Day Notes]= โcoolerโ)) and it will only light up daynotes which contain โcrockโ still when I made the formatting to turn the sentence green.
@WillA108
Do you want
OR(CONTAINS([Day Notes], โcrockโ ),([Day Notes] = โusbโ), ([Day Notes]= โcoolerโ))
or this
OR(CONTAINS([Day Notes], โcrockโ ),CONTAINS([Day Notes], โusbโ),CONTAINS([Day Notes],โcoolerโ))
NOT TESTED
I removed the extra parenthisis before the second CONTAINS and a space. Does that still work?
Once I added the appropriate amount of parenthesis the second formula worked.
OR(CONTAINS([Day Notes], โcrockโ ),(CONTAINS([Day Notes], โusbโ), (CONTAINS([Day Notes],โcoolerโ))))
Thanks Lynn!
It is now working for crock and usb but not cooler or anything else.
OR(CONTAINS([Day Notes], โcrockโ ),(CONTAINS([Day Notes], โusbโ), (CONTAINS([Day Notes],โCoolerโ), (CONTAINS([Day Notes],โtradeโ), (CONTAINS([Day Notes],โbrokenโ), (CONTAINS([Day Notes],โroom and coldโ), (CONTAINS([Day Notes],โroomโ), (CONTAINS([Day Notes],โcoldโ), (CONTAINS([Day Notes],โr+cโ), (CONTAINS([Day Notes],โh+cโ), (CONTAINS([Day Notes],โhotโ), (CONTAINS([Day Notes],โreplaceโ), (CONTAINS([Day Notes],โpumpโ), (CONTAINS([Day Notes],โnew customerโ), (CONTAINS([Day Notes],โtapโ),(CONTAINS([Day Notes],โbringโ) ))))))))))))))))
Hi Lynn,
In your edited second expression, is it possible to do the same with NOT(CONTAINS()? The error I get is the following:
ERROR: Condition NOT(CONTAINS([Comment],"crock")) has an invalid structure: no more than 1 subexpression(s) allowed
Was just wondering if there was an expression in Appsheet that would allow for multiple needles in one haystack.
The problem is not with your NOT(CONTAINS(...)) expression, it's where you're using it. Please post a screenshot of the entire expression and error message.
Hi, Thanks for the reply but I was able to get an answer and figured it out:
NOT(OR(CONTAINS([Comment], "value"), contains([Comment],"value2"), contains([Comment],"value3"), contains([Comment],"value4"), contains([Comment],"value5")))
It would be nice though to have a separate table with the restricted words and just reference them.
There is another expression offered by a friend, that works with a separate table, but there's some limitation where punctuation affects the outcome because it's not using Contains()
COUNT(INTERSECT(SPLIT([Comment], " "), Not Accepted[Word])) = 0
If you understand it and could offer feedback, it would be appreciated!
Hi @WillA108
I didnt test but i dont think you need all of those parenthisis. I have edited my second expression.
It kept adding them until it stopped coming up with an error. I thought it was odd too haha
It seems like it works, thank you!
User | Count |
---|---|
43 | |
30 | |
25 | |
23 | |
13 |