Getting multiple e-mail addresses into 1 string

Hi,

I have made an application which we use for our dog school. I have a list box with multiple clients (a class)and their e-mail addresses. Now I want to have the e-mail addresses from all clients in that list box (max 8) in a single string with a ; between each e-mail address (for outlook) In this case I can send an e-mail to the whole class. I am using the old Office templates form Softmasters.

My programming skills are not the best, that’s why I am using Clarion :wink:

Thanks!

Hi Jos,

I don’t know these Office templates, but maybe you could try something like that (qEmail is the queue that is linked to the list control):

strBigEmail    string(250)
i                     long
qEmail     queue
strEmail       string(30)
                end

  code

  strBigEmail = ''
  loop i=1 to records(qEmail)
    get(qEmail, i)
    if i=1
      strBigEmail = qEmail.strEmail
    else  
      strBigEmail = clip(strBigEmail) & ';' & clip(qEmail.strEmail)
    end
  end

Best regards,
Torsten

If using SQL, check out the string aggregate functions.
In PostgreSQL, a simple function handles this for you.

Hi,

Thanks! It’s working now!