I have a CONDITION in one of my Server Actions. It simply states that if a field is NOT either/or then carry out the action. Am I doing something wrong. I find whenever I use OR. “|” it never works (condition is not honoured)
If I just use I exclude it works fine.
In the CONDITION I am checking if the field name IS NOT from one of the queries I have in the Server Actions - so I want the condition to check if field name is NOT “exclude_item_1” OR “exclude_item_2”
For example. the query would list a bunch of names, and I want the condition to check if a field is NOT “Adam” or “John”.
The single query returns a single record, so you want to check if a value of a column returned by this exact single record is equal to John or Adam? If it is not - run the send mail?
Or do you want to loop through all the records and send email to all except John and Adam?
The single query returns a single record, so you want to check if a value of a column returned by this exact single record is equal to John or Adam? If it is not - run the send mail?
I see in your screenshot there’s an empty space after 'John ' in your expression, is that by intention?
And what is actually not working in this case?
If the name is John or Adam, does it return true, or?
Regarding the space, that was a typo. I fixed that (still the same issue)
What’s happens is that even if the value is “John” or “Adam” it still sends the email and it shouldn’t.
If you have many names to check, the expression could become rather long and unwieldy.
Yet another alternative would be to put the list of names in a variable and use ‘contains’, so the condition would be something like: v_list.contains($_GET.name.lowercase())
… where v_list contains the list (which could of course be the result of a query) and the GET variable is the name to check. Bear in mind ‘contains’ is case-sensitive, so you will probably want to make both the contents of the list and the parameter lowercase.
that’s a good idea too @TomD. Thank you! I was just thinking about how I would setup the condition if I have many exclusions. I will give this a try. Do you have a screenshot showing what you’ve explained? Much appreciated.
You will need to deal with no GET parameter being sent.
PS You might need to tweak this if you want more precise matching. Eg as it stands 'mart' sent as a parameter will match 'martin'. To prevent this, you could check also for word separators. Eg separate the words in the list with a '|' character (and add it also at the beginning and end of the list) and then add the character either side of the GET parameter.