Page 1 of 1

Concatenate contents of a field from multiple records

PostPosted: Sun Oct 17, 2004 11:32 pm
by m2
1) I need to create a report in which all entries in a particular text field are concatenated with a semicolon in between. Example: the field in record 1 reads "green, except on wednesdays". In record 2 the field contains "bleu, blanc et rouge" and in record 3 it contains "red with white spots; green, yellow; purple". The result I seek would be: "green, except on wednesdays; bleu, blanc et rouge; red with white spots; green, yellow; purple".

2) I also want to list the dates from these records with one date per line, and no duplicates. There is a date field in each record. I have it in a tabpanel but that contains duplicates when there was more than one entry on that date. Example:

02/11/2004
02/14/2004
02/24/2004

thanks...

Re: Concatenate contents of a field from multiple records

PostPosted: Wed Oct 20, 2004 7:55 pm
by bcusick
m2 wrote:1) I need to create a report in which all entries in a particular text field are concatenated with a semicolon in between. Example: the field in record 1 reads "green, except on wednesdays". In record 2 the field contains "bleu, blanc et rouge" and in record 3 it contains "red with white spots; green, yellow; purple". The result I seek would be: "green, except on wednesdays; bleu, blanc et rouge; red with white spots; green, yellow; purple".


Steps:

1) FIND the records you need;

2) LOOP through the records and build up the string you want in a local variable or global.


m2 wrote:2) I also want to list the dates from these records with one date per line, and no duplicates. There is a date field in each record. I have it in a tabpanel but that contains duplicates when there was more than one entry on that date. Example:

02/11/2004
02/14/2004
02/24/2004


STEPS:

1) Find the records (from above)

2) Put the date from the first record into a local variable or global

3) When you go to the next record - see if the global contains that date string or not. If NOT, then add it to the end of the variable.

Hope this points you in the right direction.

Bob Cusick