Jump to content

Parse Comma Delimited Data In Field


Recommended Posts

Hello,

 

I have a multi-select listbox on a datapage called "TeachingArtists" where a user can select one or more artists and assign them to an educational program that is taught in schools.

 

On a separate data page, I have the user selecting the program name and have a cascading listbox that filters on program name so user sees only the artists linked to the program name. The problem I am running into is that the some of the entries in the listbox contain multiple values of artists names separated by commas where ideally I want each artist name listed separately.

 

Is there a way that I can parse the comma delimited artist name values and present them as single entries in the listbox?

 

I am attaching a screen shot for reference.

 

post-20505-0-15658600-1463588334_thumb.g

 

Thank you for your help.

Link to comment
Share on other sites

Thank you, but I already have a JavaScript that stores multiple selections as comma delimited entries. My problem is that if I need to reference the comma delimited values at a later time in a another listbox, they are presented as one record delimited by comma. I would have liked to have had a way to parse (i.e. break) the list so each entry separated by a comma is presented separately as opposed to being part of one string.

 

For example, the entry:

Red,Green,Purple

 

Would be presented as:

Red

Green

Purple

Link to comment
Share on other sites

The above code is to enable multi select as well as separate the values where there is a comma and then select them in a listbox, instead of showing them all together separated by comma...

 

 

But if you want to have them stored in different rows in a table to be used as a lookup table later on, there needs to be some server side programming ...

Link to comment
Share on other sites

Thanks again for the helpful feedback.

 

Let me give it a try. As you said, I only need to multi select as well as separate the values where there is a comma and then select them in a listbox, instead of showing them all together separated by comma. I don't need to store them in different rows.

Link to comment
Share on other sites

  • 4 months later...

I have a similar issue, but on a Submission DataPage, and I don't need any preselection. Using javascript I was able to create a multi-select listbox that stores the user’s selections as comma-separated values in a single line:

 

writer, director, actor, producer

 

Now I would like to create a Search List DataPage that allows users to search this data using a listbox like this:

 

writer

director

actor

producer

 

Currently, the comma-separated values from each user’s submissions show on a single line. How can I get these values broken up onto separate lines of the listbox on a List DataPage?

 

 

 

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
On 5/24/2016 at 11:48 AM, MayMusic said:

The above code is to enable multi select as well as separate the values where there is a comma and then select them in a listbox, instead of showing them all together separated by comma...

 

 

But if you want to have them stored in different rows in a table to be used as a lookup table later on, there needs to be some server side programming ...

Multi Select Listbox (Submission Form) - On Errror Javascript Code Required.

 

Pseudo Code - REQUIREMENT FOR  Multi-Select Listbox in a Submission Form

ON FIRST TIME  LOAD -

Read the values from the table field into a variable

If field is blank - then dont do anything

Just populate the listbox from default element custom values


 

ON SUBMIT (SAME PAGE) -MULTIPLE VALUES SELECTED

Store the “selected value”s from listbox in an array in a hidden element

or a temp persistent variable or maybe a hidden virtual field

 

ON ERROR - REFRESH

If theres an error:- like other required fields are not filled in on form (The values are not yet committed to the database)

Then

Load the hidden element “selected values” array

In the Listbox - Match the variables array values with the drop down list element custom values

and Highlight and show them as selected .

 

IF NO ERROR

Then submit values in delimited string to table.

 

 

Thanks!

Link to comment
Share on other sites

  • 5 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...