In Report Builder 2.0, I'm trying to create a table with data like the following:
Person | StrID's
-------------------
Jim | a, b, c, d
Mary | h, k
Sue | l, m, p, z
The problem is that my Oracle SQL query returns data in the following format:
Person | StrID
--------------
Jim | a
Jim | b
Jim | c
Jim | d
Mary | h
And so on. I don't have access in Oracle to use LISTAGG
as described in this tutorial, nor can I use EXPLAIN PLAN
or tell you which version of Oracle I'm using because I have to access the database through a very limited interface. I've looked into Report Builder's functions like Aggregate
but cannot find a way to concatenate multiple string values together with an aggregate function. If I create a table grouping by Person, I get separate rows for each of the StrID's. Using Join(Fields!StrID.Value, ", ")
causes "#Error" to show up in the table cell, I assume because Fields!StrID.Value
is not actually a multi-value field, it's a single value per Person.
Can anyone tell me a way of showing a list of the associated StrID's by Person in one row, either through SQL or Report Builder 2.0/Visual Basic?
Edit: I can use the LAG function if anyone can think of a creative solution using that. Turns out I can use PARTITION BY
in conjunction with the LAG
function, too.