4 Replies Latest reply on Aug 31, 2012 12:24 PM by ZoocMan85

    Auto Check Check Box Set

    ZoocMan85

      Title

      Auto Check Check Box Set

      Post

      Hey Everyone,

      On my one layout i have a list of questions that are a checkbox set. I have a calculation on that checkbox set to auto check one of the fields if on another layout a person answers yes they have a recreational vehicle. I want to add a 2nd auto check box to the calcualation for a 2nd question however, everytime i add the 2nd question to the calc...it locks me out from checking anything in the check box. Here is the calc.  

       

      This is the current Calc that works for the one question:

      Case( Doyouhaverec = "NO" or IsEmpty ( Doyouhaverec ) ; RemoveSubList ( Self ; "Recreational Vehicle Title" ) ; ValueCount ( FilterValues ( Self ; "Recreational Vehicle Title" ) ) ; Self ; List ( Self ; "Recreational Vehicle Title" ))

      This is what im adding to it that doesnt work:

      Case( Doyouhaverec = "NO" or IsEmpty ( Doyouhaverec ) ; RemoveSubList ( Self ; "Recreational Vehicle Title" ) ; ValueCount ( FilterValues ( Self ; "Recreational Vehicle Title" ) ) ; Self ; List ( Self ; "Recreational Vehicle Title" )) or Case( UIB = "NO=0" or IsEmpty ( UIB ) ; RemoveSubList ( Self ; "UIB Determination Letter" ) ; ValueCount ( FilterValues ( Self ; "UIB Determination Letter" ) ) ; Self ; List ( Self ; "UIB Determination Letter" ))

      The no=0 was done because i have that question on another calculation that does a total and it makes yes=1 and no=0.

       

        • 1. Re: Auto Check Check Box Set
          philmodjunk

          Reformatting to make it readable:

          Case( Doyouhaverec = "NO" or IsEmpty ( Doyouhaverec ) ; RemoveSubList ( Self ; "Recreational Vehicle Title" ) ;
                    ValueCount ( FilterValues ( Self ; "Recreational Vehicle Title" ) ) ; Self ;
                    List ( Self ; "Recreational Vehicle Title" ))

          or

          Case( UIB = "NO=0" or IsEmpty ( UIB ) ; RemoveSubList ( Self ; "UIB Determination Letter" ) ;
                    ValueCount ( FilterValues ( Self ; "UIB Determination Letter" ) ) ; Self ;
                    List ( Self ; "UIB Determination Letter" ))

          The Or turns this into a boolean expression where the value auto-entered into the field will be either "True" or "False" (1 or 0).

          You can get the results that you need by "nesting" one case function inside the other. This however, will produce a truly complex expression as you'll need to put a copy of the second case function place of "self" each place that it is used in the 'Result' expressions inside the first case function.

          It might be simpler to set up script triggers on the UIB and Doyou haverec fields that use a script to update the check box fields.

          • 2. Re: Auto Check Check Box Set
            ZoocMan85

             Phil... What would be the easiest way to do this by script triggers?

            If Do You Have Rec= Yes Then auto check Recreational Title in Documentation Check Box set.

            How would i write that in a script ?

            Thanks

            Ray Z

            • 3. Re: Auto Check Check Box Set
              philmodjunk

              You'd need two scripts, one for each field and the triggers to use will depend on your field format.

              If [ YourTable::Doyouhaverec = "yes" and Not valuecount ( FilterValues ( YourTable::checkboxField ; "Recreational Vehicle Title" ) )]
                 Set Field [ YourTable::checkboxField ; List ( YourTable::checkboxField ; "Recreational Vehicle Title" ) ]
              Else If [( YourTable::Doyouhaverec = "no" or IsEmpty ( YourTable::Doyouhaverec  ) ) and
                         valuecount ( FilterValues ( YourTable::checkboxField ; "Recreational Vehicle Title" ) ) ]
                 Set Field [ YourTable::checkboxField ; RemoveSubList ( YourTable::checkboxField ; "Recreational Vehicle Title" ) ]
              End IF

              You'd use the same type of script for the second field, but with references to the other field and it's value instead of those used in the above example.

              If Doyouhaverec is a pop up menu, checkbox or radio button formatted field, the OnObjectModify buttom is a good trigger to use. If the field is a text box or drop down list (where data can thus be typed in), then the OnObjectSave Trigger can be used.

              • 4. Re: Auto Check Check Box Set
                ZoocMan85

                 Thanks Phil. Worked like a champ.