Hi,
I am struggling to complete a
for each loop with multiple criteria. I'm pretty sure I'm getting confused or going about it the wrong way.
I have a contact form with email communication options. You have the choice of the following:
- Receive reports = Yes or No.
- Site Options = All or Selected. (if Selected, a box below with multiple sites to select from and All is void.)
- Age Options = All or Selected. (if Selected, a box below with multiple ages to select from and all is void.)
Below is my criteria:
- for each contact in contacts[contact_client == client && receive_reports == "Yes" || site_options == "All" || site_options == "Selected" && selected_sites == grp.group_site]
- {
- send email
- }
I have tried many && and || combinations but it will either send email to "All" site options or "Selected". One contact may be set as all and another set as Selected with sites selected, in which case an email should go to both providing the relevant site is selected.
Should this all be done within the for each loop? Am I missing the basic concept? Should I nest multiple For Each loops?
Any help is greatly appreciated.
Many thanks