This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I am just looking for some general information on the difference between the In function and the Contain function. I use both frequently and sometimes one will work but not the other. Also, sometimes Contains will return an error stating that it requires 2 or 3 inputs- what exaclty does this mean?
I usually look at is as Contains looks for the occurrence of a particular string within a string. So Contains([variable], '123') matches '123456', but not '456789'.. I use the IN statement, mostly in the interface tools, to match several strings. [variable] IN ('1','2','3') would match any of the options (1. 2, 3 or any mix of them), not look for all.
Scott Jones Strategic Sales Engineer Alteryx, Inc.
@stef_bolo - you can't use a wildcard, as anything between " " is treated as a literal string in the contain function (unlike the Regex function below), but luckily contains([title],"PEST") will match both PEST and PESTLE, or anything else with PEST in it, such as TEMPESTUOUS.
An alternative to Contains would be regex, in which you can use a wildcard to only match things such as PEST and PESTLE but not TEMPESTUOUS:
In addition to CONTAINS or IN function is it possible to use a wildcard in a function? For example, If wanted to look for text that started with "primary", in an Access query that would say "primary*". This would return any text like primary-DR, primary-NAS, or primary-Thick. However it would not return a record like iNAS-primary or Thin-primary. Is this possible?