Displaying Multi-Select Values saved in a database

  • 23 February 2015
  • 9 replies
  • 7 views

Badge +4

So, I have created a K2 entry form that uses a multi-select controls.  It saves the values with the default ";" delimited.  What is the control that you use to display the values to the user, show to the user in a List View.  I'm guessing its the List Display.  Can someone point me to where I can find out how to do this?

 

So, I've been looking around all morning and have not found anything????  This leaves me with the thought that there is no K2 control that will display a saved multi-select value???   Does this mean that I would have to create a function that parses the field and sends the values back to K2.  That doesn't make sense??/


9 replies

Userlevel 5
Badge +18

If this is an item view, I believe you could use a "Choice" control but with Display Type property of "Check Box List", this would save and load data with the delimited semi-colon structure mapped to your Smartobject data source.

Badge +4

Didn't work, but thanks for the suggestion Tin!

 

Taffy

Userlevel 1
Badge +8

Hi Taffy

 

You can use the Choice checkbox control, but you must first set the data source of the control and then transfer in the delimited string to set the checked values. The control will display all the values from the datasource as checkboxes and then check the values that you transfer in.

 

Example:

 

On your entry form you have a Choice control with the datasource set to the list method of a  smartobject with properties ID, Name. User checks some boxes and then saves. The selected ID values are stored in another smartobject as a delimited string.

 

To display the checked values, configure a Choice control using the same data source as above. Then execute a Read smartobject method on the smartobject where you saved the values, to retreive the saved values (delimited string) and transfer them to the Choice control. 

 

If you want to display only the selected values, then I suggest you look at a way of saving the selected values a separate row in a smartobject (e.g. use a stored procedure to parse the delimited string and save a new record for each item).

 

 

Badge +4

Andrew,

 

The "Choice Checkbox" control.  I don't seem to have that.  Is it in the underground.  I have a "choice" control and a "check box list."  Neither worked for me in the way you described.

 

Taffy

Userlevel 5
Badge +18

I believe a Choice control will have 3 display options:


 


- display as drop-down list


- display as check box list


- display as radio button list


 


And by default will save and load data from the backends with a semicolon delimiter (can be changed to another character if needed).


 


13634iCA28F20EECDD6610.png

Userlevel 1
Badge +8

Hi Taffy

 

What control are you using to save the multi-select values on your entry form? 


As explained by tin you can use the Choice control (part of the SmartForms Control Pack) and set the display type to check box list.

Badge +4

Thanks for the reply Andrew, big-ups to you and Tin for your input.  I'm using a multi-select control on the entry form.  When I call the smart-object and have the multi-select on the update screen it loads the saved data fine.  Its on the list view for multiple records view that this is not loading (Drop-Down List; Check Box List; Radio Button List) do not work.   :(

 

 

Userlevel 5
Badge +18

Currently, out-of-the-box, in a list/editable listview; I do not believe you can display a control in the "Display" section, it seems to only work in the "Add/Edit" mode of a list item in a editable listview.


 


12145i6AC1878A0237C8AF.png


Add/Edit item mode


 


11540i03674AC9F2EB6292.png


During Edit Mode in Editable List View


 


 15221i6D8ECB77095BD902.png


During Add Mode in Editable List View

Badge +4

Yes Tin, correctamundo, there are no controls that I can use that can take the saved values from the multi-select and display the values in a list view, there in, was the problem.  :)

 

For anyone reading this or who have the same problem, my solution was a 3 step SQL Solution.

 

I created another smart-object method that uses t-sql syntax that

1. call a nested select statement that pulls the delimited values from the field

2. call a custom sql function that split the values from the delimiter

3. used the t-sql STUFF function to stuff the values into an alias column that I returned within the new smart-object method

 

Taffy

Reply