9 Replies Latest reply on Nov 12, 2015 2:13 PM by firecop1

    If And Statement

    firecop1

      I have a dropdown field with the values "Pass" "Fail" and "N/A". When the user selects "Fail", I would like that to trigger a radio button linked to another field called "Inspection Status" to show that the inspection failed. I am still learning my way around IfAnd statements so I was hoping someone can steer me in the right direction.   Thanks in advance.

        • 1. Re: If And Statement
          fitch

          Perhaps you could just set the auto-entry calculation for the Inspection Status field to something like:

           

          Case( fieldA = "Fail" ; "Fail" )

           

          Although it seems kind of redundant. Do you need two fields to show the same thing?

          • 2. Re: If And Statement
            coherentkris

            Agreee with TF. One field.

             

            Einstein -

            Everything Should Be Made as Simple as Possible, But Not Simpler

            • 3. Re: If And Statement
              siplus

              When you have a field formatted as dropdown, a good bet is to associate changes occurring to its contents to a script (Layout mode->Select Field->Format-> Set Script Triggers -> onObjectModify). Select a script or create it right away.

               

              In that script you can do whatever you want: set vars, set fields, commits, refreshes, gotolayouts, anything.

              • 4. Re: If And Statement
                firecop1

                Thanks folks.

                I had two options for going about this. The fields with the Pass/Fail/NA drop downs are fire code violations in a fire inspection database. Certain types of violations would trigger an immediate failure of the inspection (blocked fire exits for example). Having more than a certain number of violations would also result in a failed inspection (6 minor violations). The violations are all in tabs based on what they relate to, so the Marshal may not realize how many "Fails" he has at any point. 


                The idea behind the Radio button would be to show the Marshal right away when the inspection fails. I wasn't sure how else to accomplish this and have almost no scripting experience so this part of database design is the part that slows me down.

                 

                I still have yet to figure out how to relate the radio buttons to a count of how many fails there are to trigger it when it hits 6 violations-but I am learning. :-)

                • 5. Re: If And Statement
                  coherentkris

                  If you can define all of the rules for inspection status = failure then you can build a calculation that checks for failure automatically.

                  • 6. Re: If And Statement
                    siplus

                    If you want a 10 inch banner going red immediately in your face as a condition turns true, just use hiding to hide it normally and show it big and bad when the condition returns 1.

                     

                    A radio button, in permanent residence at the same place on screen, which goes from 0 to 1 or from left to right will NOT attract attention, it's a subtle change.

                    Something that was not on the screen and now is, will.

                    • 7. Re: If And Statement
                      fitch

                      You could calculate that like this:

                       

                      1. Start with a list of the fields that can be include in the 6 minor violations.

                      2. Filter that list for a Fail response

                      3. Count the result

                       

                      Let([

                      violations = List( fieldA; fieldB; etc );

                      fails = FilterValues( violations ; "Fail" );

                      count = ValueCount( fails );

                      result = Case( count > 5 ; "Fail" )

                      ];

                      result

                      )

                      • 8. Re: If And Statement
                        firecop1

                        Good point siplus. We discussed having a banner that only appeared if the inspection failed but I was told it was not the best way. I liked the idea as I could have made it flash or something.

                        • 9. Re: If And Statement
                          firecop1

                          Thanks again for the input everyone. I have been a Fire Marshal for 30 years and a Filemaker developer for a few months. I am learning hard and fast and having folks in this forum certainly makes it easier. I am going to give these options a try-including revisiting the banner idea.