Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, February 23, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Add each checklistbox value into a text field
SLX_Novice
Posts: 246
 
Add each checklistbox value into a text fieldYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Mar 12 8:33 AM
fiogf49gjkf0d

Hi all. We have SLX LAN v7.2.1.


I'm working with the checklistbox control (it has 4 values to choose from: A, B, C, D) and I'm trying to figure out a way to add the checklistbox values (that are checked by the end user) into a text field (mytext). The code below is what I have so far. I would like to add each value into mytext like this:


If there's just one value checked then = A


If there's 2 values checked then = A, B


If there's 3 values checked then = A, B, C


and if there's 4 values checked then = A, B, C, D


I would add the comma depending on how many values were checked in (if there was one then no comma). Any idea how I can do this? For now there will be 4 values, but in the future there could be 10, 20 , 30 so I would like to create script that will count how many are checked and from there know how many commas to add. Below is the script that I have so far, it inserts each value into a table (used for other purposes) but I'm missing the part where I want to fill in the text field (mytext) on the form.


Thank you in advance!


<p>''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'See how many checkboxes are filled in''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    j=0

    For i = 0 to CheckListBox1.Items.Count- 1

        If CheckListBox1.Checked(i) = True then

             j=j+1

         End If

    Next

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'This if-else checks to see if the end user filled in a product line checkbox.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    If j=0 then 'The end user did not fill in a checkbox

        Msgbox("You must select a product line")

    Else    'The end user filled in a checkbox, proceed to inserting into the C_PROMO_PRODUCTLINES table

        Set cn = Application.GetNewConnection

            For i = 0 to CheckListBox1.Items.Count- 1

            If CheckListBox1.Checked(i) = True then

                sql_productlines="Insert into C_PROMO_PRODUCTLINES (C_PROMO_PRODUCTLINESID, C_PROMO_HEADER_ACCOUNTID, CREATEUSER,CREATEDATE, PRODUCTLINE) VALUES ('" &  Application.BasicFunctions.GetIDFor("C_PROMO_PRODUCTLINES") & "', '" & txtPromoHeaderID.Text  & "' ,'" & Application.BasicFunctions.CurrentUserID & "','" & NOW & "' ,'" & CheckListBox1.Items.Item(i) & "')"

                cn.Execute sql_productlines

            End If  'Finish inserting into the C_PROMO_PRODUCTLINES table

            Next

 

    End If  ' End of the if-else that checks to see if the end user filled in a product line checkbox.

 

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

[Reply][Quote]
SLX_Novice
Posts: 246
 
Re: Add each checklistbox value into a text fieldYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Mar 12 10:02 AM
fiogf49gjkf0d

I think I got it to work! I replaced the commas for AND:


 



 


<p>''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'This if-else checks to see if the end user filled in a product line checkbox.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    If j=0 then 'The end user did not fill in a checkbox

        Msgbox("You must select a product line")

    Else    'The end user filled in a checkbox, proceed to inserting into the C_PROMO_PRODUCTLINES table

    txtProductLineString.Text = ""

        If j = 1 Then

            Set cn = Application.GetNewConnection

            For i = 0 to CheckListBox1.Items.Count- 1

                If CheckListBox1.Checked(i) = True then

                    sql_productlines="Insert into C_PROMO_PRODUCTLINES (C_PROMO_PRODUCTLINESID, C_PROMO_HEADER_ACCOUNTID, CREATEUSER,CREATEDATE, PRODUCTLINE) VALUES ('" &  Application.BasicFunctions.GetIDFor("C_PROMO_PRODUCTLINES") & "', '" & txtPromoHeaderID.Text  & "' ,'" & Application.BasicFunctions.CurrentUserID & "','" & NOW & "' ,'" & CheckListBox1.Items.Item(i) & "')"

                    cn.Execute sql_productlines

                    txtProductLineString.Text = CheckListBox1.Items.Item(i)

                End If  'Finish inserting into the C_PROMO_PRODUCTLINES table

            Next

        Else

            Set cn = Application.GetNewConnection

            For i = 0 to CheckListBox1.Items.Count- 1

                If CheckListBox1.Checked(i) = True then

                    sql_productlines="Insert into C_PROMO_PRODUCTLINES (C_PROMO_PRODUCTLINESID, C_PROMO_HEADER_ACCOUNTID, CREATEUSER,CREATEDATE, PRODUCTLINE) VALUES ('" &  Application.BasicFunctions.GetIDFor("C_PROMO_PRODUCTLINES") & "', '" & txtPromoHeaderID.Text  & "' ,'" & Application.BasicFunctions.CurrentUserID & "','" & NOW & "' ,'" & CheckListBox1.Items.Item(i) & "')"

                    cn.Execute sql_productlines

                      If txtProductLineString.Text = "" Then

                            txtProductLineString.Text =CheckListBox1.Items.Item(i)

                      Else

                            txtProductLineString.Text = txtProductLineString.Text & " AND " & CheckListBox1.Items.Item(i)

                        End If

                End If  'Finish inserting into the C_PROMO_PRODUCTLINES table

            Next

        end if

    End If  ' End of the if-else that checks to see if the end user filled in a product line checkbox.

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


 


[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 2/23/2025 12:19:44 PM