Page 1 of 1

Multiple select using Listbox

Posted: Fri Apr 08, 2016 7:04 pm
by Richsurvey
Hi,

I'm using a listbox object for a multiple select value. Everything is working fine (SQL query, saving to database and displaying works).

My issue is that I want it to be easily readable on the Browse screen. Based on the document here: http://wiki.nubuilder.net/nubuilderv3/i ... istbox_Tab

The multiple select listbox is "saved as a string delimited by #nuSep#" - which is what is happening, but I want it to be separated by a line break (<br>) on the Browse screen.

Also, is it not best to save the values in the database delimited using comma opposed to '#nuSep#'? - the delimited issue is not a big problem; I just want to make sure that later on I'm able to easily run a query on that field (e.g. see how many users selected Feb).

Example of what I'm doing and what is happing:
In the 'Listbox' Tab I have a very similar SQL statement: SELECT customer_id, cus_name FROM customer

cus_name has the following value:
Adam
David
Eve
Daniel
Jacob

If a user selects the first 3 names -> it gets saved in the database as: Adam#nuSep#David#nuSep#Eve (preferable I want it to be saved as Adam,David,Eve - BUT ONLY if it's easier to run a query on this later on).

In the Browse screen the values are displayed as Adam#nuSep#David#nuSep#Eve -> but I want it to be displayed like the following:
Adam
David
Eve

I've also read that maybe using a listbox for a multiple select might not be the best solution (suggestion was to use a Subform instead??)

Please let me know if there is a solution, but if not, any help that can be provided is greatly appreciated.

Thanks!

Re: Multiple select using Listbox

Posted: Mon Apr 11, 2016 6:33 am
by admin
Richsurvey,

nuBuilder will only save listboxes with #nuSep#.

If you want to manipulate this string you can use..

implode or explode in PHP

and join or split in javascript.

Steven