Using contains() to look for a list of values

Hi, 

I am looking for help with this expression, can't seem to get it right. 

OR(In([Equipment Type], list( “Remote Condenser/Walk In”, “Self Contained”)),IN(Contains([Equipment],{"Reach In", "Walk In", "Drive In"})))

I am trying to ask the question does the equipment type column have one of the values of "remote condenser" or "self contained" or does the equipment column have the phrases "reach in" or "walk In" or "drive in" in it. This is for a show if column. I can't use the in list because the equipment column is a concatenate column with other words in it for example the equipment column could say something like "walk in freezer" or "walk in cooler" so I want the expression to look to see if there is the phrase "walk in" inside of "walk in freezer" in the equipment column.

Thanks, 

Josh 

0 7 860
7 REPLIES 7

Your requirement is not exactly clear but it sounds you are looking for the following expression based on the description

OR(

      IN([Equipment Type],  LIST( “Remote Condenser/Walk In”, “Self Contained”) ),

      CONTAINS( {"Reach In", "Walk In", "Drive In"}, [Equipment] )

     )

Unlike the IN() function where value to be searched is BEFORE the list where it needs to be searched, CONTAINS() function has the value to be searched AFTER the text where it is to be searched. So [Equipment] should follow after the list.

https://help.appsheet.com/en/articles/2347639-contains

Also not sure why you have applied IN() in addition to CONTAINS() in the latter part of the expression along with CONTAINS(), you may want to elaborate if you are looking for something else other than suggested.

Let me try to make this more clear. Forget everything above and let me ask this question instead. 

How do I get the word "is" to change to "contains" in this expression. 

contains.PNG

Is that possible? 

 

Thank you, 

Josh 

I tried the expression you gave me.

tried yours.PNG

and the enum column does not show up even though the equipment name does contain the word "reach in" 

When I try the expression with a singular value mine.PNG

It does show the freezer/cooler enum selection 

new lister.PNG

thank you. The "Reach In"  string is in the 'Equipment Type' column in the screenshots shared by you and not .  Is it the display name of the [Equipment] column?

Could you elaborate?

Could you share possible likely values of [Equipment] column. Will they be only  {"Reach In", "Walk In", "Drive In"} or something like "Reach In Time" " Walk In Slowly" etc. Meaning is "Reach In" likely to be a part of of larger string or it is always just {"Reach In", "Walk In", "Drive In"}. If its is only those values without any extended string, then you can use IN() as well.

Or else the suggested expression looks correct to me.

In your example yes it would be "reach in time" "walk in slowly" etc. Which is why I cannot use the IN() function I am guessing because IN() looks for exact values that match exact. Where I am looking for just part of the string to match.  I am looking to have the app look at two separate columns. Essentially it used to only look at the [Equipment Type] column so I only needed the first expression. However now I am changing things around in my app. So I want it to keep the first expression for the "old version" of the app and then also look at the [Equipment] column which has a display name of [Equipment Name] the reason for the display name is again because I am changing things around in my app and I am using this column for two different purposes. One for the "old app" purpose and another for the "new app purpose". However, the important thing I am asking is how do I get contains  to look for a list of values not just one value. 

containsss.PNG

Like this but without having to write the same expression over and over again.

 

Thank you, 

Josh Klassen 

Thank you for all this latest detailed explanation that has made the things much clearer.

You are correct that IN() will need exact value for search in a list and CONTAINS() will look for one string in another larger string.  

 I think you have a kind if many to many search, meaning both the text being searched in and the text being searched with can have multiple values. Under such scenario, I believe you will need to go for multiple CONTAINS() as you have attempted.

One could still try to construct another expression for this many to many search but I believe it will not be a trivial expression.

Top Labels in this Space