Forum Discussion

RajHelaiya's avatar
RajHelaiya
Qrew Captain
8 years ago

Multiple Conditions in a form rule using Multi Line text

I have a multi line text field 'Workout' with 3 values 'Running', 'Biking' and 'Weight Lifting' , I am trying to use dynamic rules in a way that when Running or Biking are selected from the multi line text, 2 fields 'Distance' and 'Time' should be displayed on form and when 'Weight Lifting' is selected they are hidden and other 3 fields are displayed. I can't put both the biking and running conditions in rules as they contradict each other when formed as separate rules. Can anyone help with the solution? attached is the picture.
    • RajHelaiya's avatar
      RajHelaiya
      Qrew Captain
      Well, it contradicts other rules. When I select is equal to the value of biking or running then show distance and time . But when I need to select weight lifting distance and time need to be hidden and other fields such as reps and weight in pounds need to be displayed. I suppose I have conflicting rules on same field Distance and TIme. 
    • ChuckGrigsby's avatar
      ChuckGrigsby
      Qrew Cadet
      You can have different tiers of rules in a single form rule. Can you consolidate at all?
    • RajHelaiya's avatar
      RajHelaiya
      Qrew Captain
      Yes, but when consolidating all conditions one remains. Distance and Time are shown initially in the form which is not intended. See attached. 
  • I think what you need to do here is create some formula checkbox fields that are used to drive the display logic. That way, the logic in the form rules for what to display will be much simpler, and you have a layer to hide that complexity. have a [Display xxxxx?] field for each field that you need logic to show or hide on your form. Set up an If statement in your formula for each to encode your business logic for whether or not to show or display it, based on the selections in the other field(s). Then set up a dynamic form rule for each Display formula checkbox field in the when part and show or hide that field accordingly in the Action part. That way, you won't be setting up multiple dynamic form rules that contradict each other when more than one refers to the same field. The only limitation here is that you can't have more than 20 dynamic form rules per form.
    • RajHelaiya's avatar
      RajHelaiya
      Qrew Captain
      Thanks Michael, it worked this time but having a formula is an important feature if there are multiple rules.
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    Create a rule that has "Multiple Conditions are true" and make it "any"
    then make the two conditions with the logic for when its running OR biking, it shows the desired fields.

    Then same logic will apply for weights to 'show' the reps, sets, exercise, weight in pounds.
    • RajHelaiya's avatar
      RajHelaiya
      Qrew Captain
      Thank you. Yes, combining multiple conditions with other rules, I achieved the desired display of fields.