2 Replies Latest reply on Mar 6, 2014 5:24 PM by hjvanes

    Checkbox and populate results in a field

    hjvanes

      Dear FM PPL,

       

      I have thought a little about this but not sure how best to go about it.

       

      Say I have 3 checkboxes with value list Yes and No

       

      1. Name (If value = "1"; table:name; "" )

      2. Address = (If value = "1"; table_address; '')

      3. Postal Code = (If value = "1"; table_postcode; "")

       

      I also have a field : address_details

       

      How could I go about populating the address_detail field with "Jane Doe 9999" when checkboxes1 and 3 have been set to yes. Also is there a way that I can go about setting up a particular order the user would like to have the data populated in the field, ie if they want 9999 first followed by Name and the next user may want name followed by 9999.

       

      Any pointers or help is greatly appreciated and thank you in advance.

       

      regards,

      HJ

       

      PS. Now I know I can put a value list in place with several checkboxes and add them all together into a calculation . But I just want one check box with a value list obtainign values from different fields and having them put into the one field and on the same line and not sepereate lines if that makes sense.

        • 1. Re: Checkbox and populate results in a field
          erolst

          hjvanes wrote:

          Say I have 3 checkboxes with value list Yes and No

          1. Name (If value = "1"; table:name; "" )

          2. Address = (If value = "1"; table_address; '')

          3. Postal Code = (If value = "1"; table_postcode; "")

          Now, what is your value list – Yes and No, or 1 and …? (and if it is 1, use 1 – not "1" …)

           

          Suggestion: create a value list with a just a 1 for these Boolean checkboxes; then your calculation could be e.g.:

           

          Let (

            ~l = List (

              Case ( useName? ; table:name ) ;

              Case ( useAddress? ; table_address ) ;

              Case ( usePostcode? ; table_postcode)

              ) ;

            Substitute ( ~l ; ¶ ; ", " )
          )

           

          If you want to preserve the click order: create one static value list with the values 1, 2, 3; display it on the layout with just the boxes, not the values, and show a text legend next to it.

          Then use:

           

          Let ( [

            ~s = yourSelectionCheckBox ;

            ~l = List ( name ; addressLine ; postCode ) ;

            ~res = List (

               GetValue ( ~l ; GetValue ( ~s ; 1 ) ) ;

               GetValue ( ~l ; GetValue ( ~s ; 2 ) ) ;

               GetValue ( ~l ; GetValue ( ~s ; 3 ) )

              )

          ] ;

          Substitute ( ~res ; ¶ ; ", " )

          )

           

          Simplified version of 2nd calc

          • 2. Re: Checkbox and populate results in a field
            hjvanes

            Hi Erolst,

             

            Thank you for your reply.  I chose the second option of yours.  Works like a charm now.

             

            Really do appreciate it and just learning new coding/calculation skills.  Remarkable the things that I still can learn.

             

            regards,

            HJ