[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

Help with contains in a formula

I have the following code in a calendar view:

SELECT ((Form = "Time Off Request") | (Form = "TimeOff")) & (@Contains(Add_Calender; "Yes")) & (@Contains(Type; "Associate")) & (!@Contains(Status; "Pending")) & (!@Contains(Team; "LCCC")) &  (!@Contains(Team; "Team Services")) & (!@Contains(Team; "Mail/Image")) &(!@Contains(Team; "LRU"))  & (!@Contains(Team;"Team Services/Filing")) & RequestType !="Overtime"

This does work but I am wondering if there is a better way to write the Does Not Contain portion. I have tried this:

!@Contains(Team;"LCCC"|"Team Services"|Mail/Image"|"LRU") and that does not work. It will not pull any records then at all.  Does anyone have any suggestions or am I just missing the boat on how @Contains works.

1 Solution
I think you are confusing @Contains and @IsMember.

@Contains is used to search a string for a sub-string.
@IsMember (and @IsNotMember) are used to indicate whether a list (or multiple-value field) includes a specific value.

Further, if the field can only accept one value, and you are matching the full value (not a sub-string), then you can simply use the 'equals' operator (=).

For example, it appears to me that Add_Calender is a single-value field that either contains "Yes" or "No".  If this assumption is correct, then I would not use @Contains, I would just use (Add_Calender = "Yes").

Below is an example of how I would write this selection formula based on these assumptions:

Single-valued fields:

Multiple-valued fields:

(If these assumptions are not correct, then the formula below will need to be modified).
SELECT @IsMember(Form; "Time Off Request" : "TimeOff") & 
(Add_Calender = "Yes") & (Type = "Associate") & (Status != "Pending") & 
@IsNotMember(Team; "LCCC" : "Team Services" : "Mail/Image" : "LRU" : "Team Services/Filing") & 
(RequestType != "Overtime")

Open in new window

kali958Author Commented:
Thank you Bill. That is what I needed. I was missing the difference between the @Contains and @IsMember. I thought also that @IsNotMember and @IsMember was only to be used with UserRoles.  I appreciate the education and the prompt answer!  Thanks again

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now