“Robertson, Michele R” wrote:
I have a need to concatenate all the values chosen in one object. For
example, there are several topics a user can mark off for a particular
customer, however, when I pull a report, a row is listed for every topic
that is checked off, even though it is the same customer. Like this:
Customer Name Topic 1
Customer Name Topic 2
Customer Name Topic 3
Is there a way to have the values concatenate so that there is only one row
per customer, with all of the values in one cell? Like this:
Customer Name Topic 1, Topic 2, Topic 3.
Yes, there is.
A) Report Version:
You can define some local variable as:
topic1 = if customer = previous() then previous()&", " else
“”
topic2 = if customer = previous(previous()) then
previous(previous()) & ", " else “”
topic2 = if customer = previous(previous(previous())) then
previous(previous(previous())) & ", " else “”
…
and the one you display in your report:
all_topics = topic1 & topic2 & topic3 & … & topic_n
But some limitations:
1. maximum number of simultaneousely available topics per customer must be
known in advance
2. data must be sorted on , otherwise the previous() will not work
properly…
B) Database/Designer Version
Create a UNION view in your database which will transpose the “rows of topics” to
“columns” of topics, one row per customer anbd define a new object in designer…
hope, it helps
Walter
Walter Muellner
Delphi Software GmbH, Vivenotgasse 48, A-1120 Vienna, Austria
Tel. +43-1-8151456-12, Fax: +43-1-8151456-21
e-mail: w.muellner@delphi.at, WEB: http://www.delphi.at
Listserv Archives (BOB member since 2002-06-25)