Is there any way to do more complex logic, for example: If A and (B or C or D): Then do X ?

  • modMD Health
    Asked on September 1, 2023 at 2:30 PM

    Is there any way to do more complex logic, for example:

    If A and (B or C or D):

    Then do X

    ?

  • Justin_E Jotform Support
    Replied on September 1, 2023 at 6:53 PM

    Hi modMD,

    Thanks for reaching out to Jotform Support. Can you give us more information on what you are trying to achieve so we can have a better understanding of what the situation is? If you can take a screenshot of what’s happening, that will help us to better understand what’s going on. We have a guide about how to do that here.

    We'll be able to move forward once we hear back from you.

  • Oneill_Rosie
    Replied on September 5, 2023 at 12:10 AM

    Hi Justin,

    I have a form # 231905420595052, in which i have a question where is the answer is yes, there are 10 follow on questions. If any of the ten follow on questions is also yes, then I want the system to fire off an email, the problem is, I could only code it as individual instance of two yes's, so if the person who fills out the form says yes to 5 conditions that follow from saying yes to the first, then they will get 5 emails that are all the same.

    Here is a screen shot of some of these rules: Is there any way to do more complex logic, for example:
If A and (B or C or D):
Then do X
? Image-1Is there any way to do more complex logic, for example:
If A and (B or C or D):
Then do X
? Image-2

    What I really want is to say IF "you have been selected to wear a full face mask IS EQUAL TO YES ..." AND ("you have difficulty moving your head up and down IS EQUAL TO YES" OR "You have difficulty moving your head side to side IS EQUAL TO YES" OR "You have difficulty bending your knees IS EQUAL TO YES" ....) THEN SEND the Telehealth required email.


    Is this possible?


    Let me know if you need more details.

    Thanks!

    Nadine


  • Nora JotForm Support
    Replied on September 5, 2023 at 4:22 AM

    Hi Nadine,

    Thanks for getting back to us and explaining the issue in detail. I understand what you're trying to do with email conditions, but I'll need some more time to explain how you can accomplish that.

    In the meantime, let us know if you have any other questions.

  • Nora JotForm Support
    Replied on September 5, 2023 at 6:31 AM

    Hi Nadine,

    Thanks for waiting patiently while I was looking into this. I understand that you have one stable field, and other fields that you want to pair with the stable field, and want to create conditions depending on your pairs.

    Since you only want one email to be sent, we'll set up the condition to send email dependent on a Number field, and send the email if the number is more than zero. Also, we'll change your email conditions to Update/Calculate conditions so that when the condition is met, the Number field will be updated to 1. So, if any of these condition pairs are met, the Number field will be 1; and we'll have another condition to trigger an email if the Number field is above 0. Let's do it:

    • First, open your form in Form Builder and drag and drop a Number field onto your form.

    Is there any way to do more complex logic, for example:
If A and (B or C or D):
Then do X
? Image-1

    • Then click on Settings in the orange navigation bar at the top of the page.
    • Select conditions from the menu on the left side of the page.
    • Click on Add a New Condition, and select Update / Calculate Field.

    Is there any way to do more complex logic, for example:
If A and (B or C or D):
Then do X
? Image-2

    • Set up your condition like you can see below, and click on Save.

    Is there any way to do more complex logic, for example:
If A and (B or C or D):
Then do X
? Image-3

    Create this condition for all the pairs you have. You can clone the existing condition so that it will be easier. Here's how:

    • On the Conditions section of the Settings page, click on the Gear Icon on the Update / Calculate condition you've just set up.
    • Select Clone, and edit the new condition according to the other field.

    Is there any way to do more complex logic, for example:
If A and (B or C or D):
Then do X
? Image-4

    Now, you can delete all the existing email conditions related with these fields, and create another one that will be triggered by the Number field when it's above 0. Let me show you how:

    • Still under the Conditions section, click on Add a New Condition, and select Change E-Mail Recipient.
    • Set up the condition like you see below:

    IF: Number

    STATE: Is Greater Than

    VALUE: 0

    SEND: Telehealth Required

    EMAIL: (Enter the preferred email)

    • Click on Save.

    Is there any way to do more complex logic, for example:
If A and (B or C or D):
Then do X
? Image-5

    That's it. Reach out again if you need more help.

  • murphyde835
    Replied on September 26, 2023 at 6:29 AM

    Very detailed answer. Thanks.

    coreball