How can I make a condition with ANY and ALL at the same time

  • GaumardScientific
    Asked on August 6, 2019 at 4:14 PM

    Hi fellas


    I guess my question has been asked many times but I can't find a satisfactory answer around here.

    So I need to recreate the following formula in ONE SAME condition dialog:

    (A is Empty OR B Is Empty OR C Is Empty) AND Z = 0

    I think is not possible by design because we can only select one operator: ANY (OR) or ALL (AND).


    Please let me know.


    Thanks!

  • denis_calin Jotform Support
    Replied on August 6, 2019 at 5:35 PM

    Hi @GaumardScientific!

    You can achieve this by creating 3 conditions which are:

    A is empty AND Z is equal to 0

    B is empty AND Z is equal to 0

    C is empty AND Z is equal to 0

    However, the condition will be satisfied if all three are empty and Z is equal to 0 as well.

    1565127094Screen Shot 2019 08 06 at 2 Screenshot 10

    I have made a sample form, please take a look at it and clone it to see if it meets your requirements.

    Form: https://form.jotform.com/92176581286971

    Guide: How-to-Clone-an-Existing-Form-from-a-URL

  • GaumardScientific
    Replied on August 8, 2019 at 10:17 AM

    That works for an isolated set case only. What about this:

    IF (A is Empty OR B Is Empty OR C Is Empty) AND Z = 0 THEN ENABLE X

    IF (D is Empty OR E Is Empty OR F Is Empty) AND Z = 0 THEN ENABLE X

    IF (G is Empty OR H Is Empty OR I Is Empty) AND Z = 0 THEN ENABLE X

    IF (J is Empty OR K Is Empty OR L Is Empty) AND Z = 0 THEN ENABLE X

    The above example represents lines of a matrix where I need the 3 first column of each line or nothing in the line to be filled up in order to allow to submit the form. But if the user fills  less than the three mandatory column, then can't submit either. Also, at least one line must be filled up in order to allow to submit.

    I actually have 6 columns but only the first 3 are mandatory and one of them is a dropdown and so that's the reason I am not using your Input Table which lacks of complex validation scenarios and it gets worse when setting the control to multiple type column.

    Here is what I need to achieve:

    ALLOWED

    1565272922Untitled1 Screenshot 10

    1565272964Untitled2 Screenshot 21

    1565272983Untitled3 Screenshot 32


    NOT ALLOWED

    1565273424Untitled4 Screenshot 43

    1565273492Untitled5 Screenshot 54


    Thank you.

  • Kiran Support Team Lead
    Replied on August 8, 2019 at 12:02 PM

    It may be possible to setup the conditions to achieve your requirement. But it could be some complex. A simple workaround could be using configurable list widget so that you mark the fields as required and the user will not be allowed to submit the form without filling them. 

    https://www.jotform.com/help/282-How-to-Set-Up-the-Configurable-List-Widget

    Let us know if that works for you. 

    Thanks!

  • GaumardScientific
    Replied on August 8, 2019 at 3:33 PM

    Hi Kiran,

    Thank you for leading me to the use of the Configurable List Widget. As you stated, it can handle the validation to the table level but I still have 2 issues:

    1. I need validation on number of characters allowed, and email pattern for the text fields.

    2. I need to delete one single row if the maximum has been reached according to the value of one checkbox control. My max is 4 rows, so if the checkbox is checked and there are already 4 rows, I need to remove the last one (regardless if filled or empty) and my max must become 3. If unchecked, max will be 4 again and the add button must become enabled.

    Is there any simple way to do that?

     

    Thank you.

  • denis_calin Jotform Support
    Replied on August 8, 2019 at 4:41 PM

    Hi @GaumardScientific!

    I am not sure if these 2 points are possible with the Configurable List widget. I have created a sample form using Short Text Entry fields and Dropdown fields. The advantage of Short Text Entry field is that it allows to

    a. Limit the number of characters allowed

    b. Has validation for Email, Numeric, Alphabetic, etc entries

    c. Has an input mask option (if you would like certain fields to be entered in a certain format, such as (###) ###-####)

    I have also used the Enable/Require Field condition to require the first three columns if the first column is filled. If the column is left empty the row will not be required. I also used a Show/Hide Field condition to remove the last row (my sample form has only 2 rows) via a checkbox. Please clone the sample form to see if this approach fits your requirements.

    Form: https://form.jotform.com/92196400581961

    Guide: How-to-Clone-an-Existing-Form-from-a-URL

  • GaumardScientific
    Replied on August 9, 2019 at 8:25 AM

    Hi @denis_calin

     

    So, I either get to have the former or the latter but not both in a single form?

    I, for sure, know that using short text fields I can limit characters, validate entry and even use input mask. I started this thread using that already but apparently having to stack an insane amount of conditions to achieve what I need.



    Thanks.

  • Mike_G JotForm Support
    Replied on August 9, 2019 at 10:29 AM

    I have checked the requirements you mentioned in one of your replies in this thread and based on my understanding your requirements, I have updated a cloned version of the form my colleague created. Here's the link to the cloned version of his form— https://form.jotform.com/92204539123956

    I have included a Button Checkboxes widget that will serve as the "Add Row" button of the table. Then, I use a condition to make it work. Including that condition, the form has a total of only 5 conditions.

    1565360854zt10 26 41 Screenshot 10

    1565360869zt10 26 18 Screenshot 21

    I hope this helps. If you have other questions or concerns, please do not hesitate to let us know.