1 (edited by CDB 2020-06-01 07:34:22)

Topic: multi-dimensional arrays

As MVD doesn't allow multi-dimensional arrays, is there a work - a - round other than declaring a number of individual strings and then concatenating them together?


Basically I'm building the body of an email text. I need to read in 4 columns of a database and then display them as one string, and repeat this for however many rows I need to read in.


My thinking was to read in 4 columns and assign them to one row and then use a TStringlist to add each complete row and then use the 'text' method  of the TStringlist to be the  'body' of the email.


So in  the database I have - column 1, column 2 column 3  on each row.

I need to 'format' this so that in the email  it looks like one 'sentence' and repeat this for however many rows have the information I need to send.


I thought about using a non visible Rich Text Box and then using that result as the body of an email, but that seems to be an unnecessary step.

On a clear disk you can seek forever

2 (edited by derek 2020-06-01 10:44:59)

Re: multi-dimensional arrays

Hi CDB,
Perhaps do it with a calculated field - something along the lines of the attached?
Derek.

Post's attachments

Attachment icon cdbconcatenate.zip 337.23 kb, 275 downloads since 2020-06-01 

3 (edited by CDB 2020-06-01 11:57:28)

Re: multi-dimensional arrays

Thanks Derek,


It never occurred to me to use a calculated field. I'll have to study it carefully and think of ways to take the output straight to the email body.

My current incarnation does what I need,  but only if one item is attached to a PO, because the SQL query returns all items that are attached to a PO (which of course is what I want) I have yet to succeed in getting that into the email body.  Hence my thoughts going towards a multi dimensional array.


In an ideal world, if the export to Excel could be persuaded to export directly to an email, I'd be buying the cats expensive food for a week! smile


How did you disable events in your demo program?  I went to fiddle and there is no event tab appearing in the object inspector. Perhaps you are using a different build?

Post's attachments

Attachment icon no_events.PNG 97.65 kb, 123 downloads since 2020-06-01 

On a clear disk you can seek forever