Discussions

Expand all | Collapse all

Dynamic Form Rules

Jump to Best Answer
  • 1.  Dynamic Form Rules

    Posted 12-26-2019 06:32
    Hello,
    I have a form where a user has to insert the number of products (1-3), then, if the user inserts 1, ONE row of fields of the products details should show and user will have to fill (Model1, Expiry Date1, Status1), if the user chooses 2, TWO row of fields of the products details should show and user will have to fill (Model1, Expiry Date1, Status1) AND (Model2, Expiry Date2, Status2) , if the user chooses 3, THREE row of fields of the products details should show and user will have to fill (Model1, Expiry Date1, Status1) AND (Model2, Expiry Date2, Status2)  AND (Model3, Expiry Date3, Status3) 

    I have created 9 Fields:
    Model1, Model2, Model3
    Expiry Date1, Expiry Date2, Expiry Date3
    Status1, Status2, Status3

    I created a rule: if number of products = 1, hide Model2, Model3, Expiry Date2, Expiry Date3, Status2, Status3
    I wanted to create a second rule: if number of products = 2, hide Model3, Expiry Date3, Status3

    but an error message showed up saying that:
    "Rules #1 and #2 are both 'show/hide' rules on the same field (Model3).

    Only the last (highest numbered) of these rules will have any effect. Consider combining these rules into a single 'multiple condition' rule instead. more..."

    how can I solve this?

    Thank you

    ------------------------------
    Sarah Eldurini
    ------------------------------


  • 2.  RE: Dynamic Form Rules

    Posted 12-26-2019 07:25
    Sarah,

    I strongly encourage you to rethink the architecture.    Create a Parent Child Relationship between your Business Object at the top and the Products.  I am going to call the first table Orders for simplicity sake.



    • Now you can have an unlimited number of Products with each order
    • The form rules on your Products table are independent of the data on a previous Product
    • You can create your reports against the Products table which will give you much more flexibility for Notifications, Management Reporting 
      • For example you can get a Summary report of all Products expiring this Month with a Status of "Life Threatening" or what ever else you are business rules require. 


    ------------------------------
    Don Larson
    Paasporter
    Westlake OH
    ------------------------------



  • 3.  RE: Dynamic Form Rules
    Best Answer

    Posted 12-26-2019 07:32
    Hello Sarah, 

    Don has a great point in regard to the architecture and if you can do that , you likely should.  But if not, you will need to change the way you are thinking about the rules. Think about what conditions would fit into one rule for show/hide on each field.  There are many ways to do this.  Here is one example that should work if I am understanding your requirements correctly.

    Rule #1
    When # of products -  is equal to  - 1 OR 2 OR 3
    show model 1 
    show Expiry 1
    show status 1

    Rule #2
    When # of products -  is equal to - 2 OR 3
    show model 2 etc.

    Rule #3
    When # of products - is equal to - 3
    show model3 etc.
    ​​​​​
    This way, you are only applying the show/hide action once per field and you will not receive the error and the correct number of rows will appear based on the # of products they are entering.   ​​​​​

    ------------------------------
    Brandon Drake
    JHI Group
    Monroeville, OH
    ------------------------------



  • 4.  RE: Dynamic Form Rules

    Posted 12-26-2019 08:45
    Brandon,

    I'm a little New to this but your suggestion helped A LOT

    Thank you

    ------------------------------
    Sarah Eldurini
    ------------------------------



  • 5.  RE: Dynamic Form Rules

    Posted 12-26-2019 10:58
    Sarah, 

    Glad I could help.

    ------------------------------
    Brandon Drake
    JHI Group
    Monroeville OH
    ------------------------------