Extracting data from multiple dropbox

Results 1 to 3 of 3

Thread: Extracting data from multiple dropbox

  1. #1
    Elaine Pack Guest

    Default Extracting data from multiple dropbox

    This is the first time I&#039;ve had to work with multiple selection dropboxes. This is almost certainly a simple question but I&#039;m not doing something right, so would appreciate a pointer in the right direction. <BR><BR>I have a select box (ie, drop box) that permits multiple selections, and I need to extract each selection the user makes. However, I don&#039;t have my syntax exactly right because what I&#039;m getting is the entire selection instead of each individual one.<BR><BR>The values selected come into my posting program as a string exactly like this (no quotes, of course): "1234 , 5678 , 9012 ". I need to create new records for each of the 3 values, but first I need to isolate those values. I moved the inputted field to an array field, then did a for/next loop thru the array field, but the results didn&#039;t parse out as I&#039;d thought they would. A simple response.write of the data inside the loop resulted in the full string, displayed just once.<BR><BR>Obviously I have to parse out the values based on the delimiters of space and/or comma as shown [the actual values will not have embedded spaces] but I&#039;m not quite sure how to do that, and would appreciate a pointer or three :)<BR><BR>Here&#039;s the basic code:<BR><BR>infield = "1234 , 5678 , 9012 " <BR>arrayfield = array(infield)<BR><BR>for each x in arrayfield<BR> response.write "val=" &x &"[cr code]" <BR>next<BR><BR>What results is this:<BR><BR>val=1234 , 5678 , 9012 (without the quotes and there is a final space after 9012)<BR><BR>Would appreciate the correct way to handle this--thanks!<BR>

  2. #2
    Eddie Campbell Guest

    Default RE: Extracting data from multiple dropbox

    I&#039;m not sure I quite follow what you are doing, but this code should help:<BR> infield = "1234 , 5678 , 9012 " <BR> infield = replace(infield," ","") &#039; Get rid of the spaces<BR> arrayfield = Split(infield,",") &#039; Turn it into an array<BR> For i = 0 To UBound(arrayfield)<BR> Response.Write "Array Element " & i & " = " & arrayfield(i)<BR> Next<BR>

  3. #3
    Elaine Pack Guest

    Default RE: Extracting data from multiple dropbox

    Thanks, Eddie!! That did the trick! I knew it had to be something simple, but I wasn&#039;t aware of the split command.<BR><BR>elaine

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts