4 Replies Latest reply on Feb 11, 2017 12:03 AM by Philip_Jaffe

    Extracting checkbox values from a parameter

    laguna92651

      I am passing the following parameters to a script, the clients_joinclientContractor::Skill field is a checkbox with multiple text values in it. I can't get the values out of this field to increment in the loop. This is the step I'm using to extract the check box values for use in the loop, but I don't get anything,

      Set Variable[$skill; Value:GetValue ( $skillparm ; $pos ) ]

       

      Parameter

      List( CLIENTS::ID_Client ; clients_joinclientContractor::Skill )

       

      Script

      Set Variable[$ClientID; Value:GetValue ( Get ( ScriptParameter ) ; 1 ) ]

      Set Variable[$skillparm; Value:GetValue ( Get ( ScriptParameter ) ; 2 ) ]

       

      Loop

      Set Variable[$pos; Value:ValueCount ( clients_joinclientContractor::Skill ) ]

         Loop

          Exit Loop If[$pos = 0]

          #----- Gets value from Skill checkboxes squentially.

          Set Variable[$skill; Value:GetValue ( $skillparm ; $pos ) ]

          / /  Set Variable[$skill; Value:GetValue ( clients_joinclientContractor::Skill ; $pos ) ]

          Set Variable[$pos; Value:$pos - 1]

         

          Go to Layout[“L03_JOIN_CONTRACTOR_CLIENT” (JOIN_CONTRACTOR_CLIENT) ]

          New Record/Request

          #----- Set in L02 Contractor Detail

          Set Field[JOIN_CONTRACTOR_CLIENT::id_client ; $ClientID]

          #----- Set in Client parameter Pop Up

          Set Field[JOIN_CONTRACTOR_CLIENT::id_contractor ; $$ContractorID]

          #----- Cycle through selected Skills.

          Set Field[JOIN_CONTRACTOR_CLIENT::Skill ; $skill]

          End Loop

       

      Close Window[ Name: "Popup addresses" ]

      Commit Records/Requests[No dialog]

      Exit Script[  ]

      End Loop

        • 1. Re: Extracting checkbox values from a parameter
          philmodjunk

          The check box values in your check box field are separated by returns. Your parameter expression uses list to combine the client ID with the list of values in the check box fields.

           

          your set variable step uses get value to get the 2nd value. That will only get the first selected check box value instead of all the check box values.

           

          Use RightValues to get all of them or use the entire script parameter with your index in the loop starting st 2 instead of 1.

          • 2. Re: Extracting checkbox values from a parameter
            Philip_Jaffe

            1.  Your first Loop will Exit Script after the first pass.  What is that outer loop supposed to do?

             

            2.  Your parameters passed via List( CLIENTS::ID_Client ; clients_joinclientContractor::Skill ) produces this result:

             

             

            ClientID

            Skill 1

            Skill 2

            Skill 3

            skill 4

            ...etc

             

            GetValue ( Get (ScriptParameter) ; 1 ) = "ClientID"

            GetValue ( Get (ScriptParameter) ; 2 ) = "Skill1"   and NOT the remainder of the entire value list.

             

            Try:    Set Variable[$skillparm; clients_joinclientContractor::Skill ]  instead.

            • 3. Re: Extracting checkbox values from a parameter
              ChrisJohnston

              At first glance, you start out using a function on your list. You need a variable to just be that list. Or just refer to the field.

               

              Set Variable[ $Skill; Get ( ScriptParameter )  ]

               

              or just...

               

              Set Variable[ $Skill; clients_joinclientContractor::Skill )  ]

               

              A function should be in the iteration of the loop to help point to that number of the list. The list (clients_joinclientContractor::Skill) must be referenced in the loop not wrapped in a function.

              Set Variable[ $Skill; Get ( ScriptParameter )  ]

              • 4. Re: Extracting checkbox values from a parameter
                Philip_Jaffe

                Would this work for you?

                 

                Parameter

                {CLIENTS::ID_Client}

                 

                Set Variable[$ClientID; Value:Get ( ScriptParameter ) ]

                Set Variable[$skillparm; Value:clients_joinclientContractor::Skill ]

                Set Variable[$pos; Value:ValueCount ( $skillparm ) ]

                 

                Go to Layout[“L03_JOIN_CONTRACTOR_CLIENT” (JOIN_CONTRACTOR_CLIENT) ]

                 

                Freeze Window

                 

                Loop

                  Exit Loop If[$pos = 0]

                  Set Variable[$skill; Value:GetValue ( $skillparm ; $pos ) ]

                  Set Variable[$pos; Value:$pos - 1]

                 

                  New Record/Request

                  #----- Set in L02 Contractor Detail

                  Set Field[JOIN_CONTRACTOR_CLIENT::id_client ; $ClientID]

                  #----- Set in Client parameter Pop Up

                  Set Field[JOIN_CONTRACTOR_CLIENT::id_contractor ; $$ContractorID]

                  #----- Cycle through selected Skills.

                  Set Field[JOIN_CONTRACTOR_CLIENT::Skill ; $skill]

                End Loop

                 

                Close Window[ Name: "Popup addresses" ]

                Commit Records/Requests[No dialog]