Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Concatenating strings with Aggregation Builder issue/question
Concatenating strings with Aggregation Builder issue/question [message #1173842] Wed, 06 November 2013 19:55 Go to next message
Nathan Darby is currently offline Nathan DarbyFriend
Messages: 2
Registered: November 2013
Junior Member
I am using an older version of BIRT (SDK is 2.3.1.v20080701) due to my software requirements...I can not upgrade at this time.

Basically I'm trying to create a "breadcrum" from a possibly infinite parent/child relationship.

Example:

CHILD | PARENT
---------------
46 |
47 | 46
48 |
49 | 48
50 | 46
51 | 49

To handle this, I wrote a recursive SQL statement that will flatten based on what you select.

Example 1 - if you select 50...you would get
CHILD | PARENT
---------------
46 |
50 | 46

Example 2 - if you select 51...you would get
CHILD | PARENT
---------------
48 |
49 | 48
51 | 49

This all works great for me until I actually concatenate this using the Aggregation Builder.

I have:
1) bound a table to the DataSet mentioned above
2) I then GROUPed the DataSet
3) I then added a CONCATENATE Aggregation

This actually works really well...EXEPT I have an option for a "Separator" (Which has apparently gone away in newer versions, as all the screen shots I've seen don't have it) where I provide it " / "

The end result is...

Example 1
46 / 50 /

Example 2
48 / 49 / 51 /

These seem so easy, but I can NOT figure out how to get rid of the last "/"

NOTE: If you attempt to reference the row["Aggregation"] you will get back as many rows as you have levels...

i.e. for Example 2 you would get:
48 / 49 / 51 /
48 / 49 / 51 /
48 / 49 / 51 /
because there are 3 levels

My next attempt feels close...
row["Aggregation"].substr(0,row["Aggregation"].lastIndexOf("/"))
this unfortunately returns multiple rows..but I got rid of the "/"
48 / 49 / 51
48 / 49 / 51
48 / 49 / 51

Any help is much appeciated.

Re: Concatenating strings with Aggregation Builder issue/question [message #1174886 is a reply to message #1173842] Thu, 07 November 2013 11:23 Go to previous messageGo to next message
donino donino is currently offline donino doninoFriend
Messages: 183
Registered: July 2011
Senior Member
You could use a global variable for this:
- declare a global variable in "initialize" event of the report:
myGlobalVar="";

- set this variable in the "onCreate" event of the datacell of the table, with the expression you mentionned:
myGlobalVar=row["Aggregation"].substr(0,row["Aggregation"].lastIndexOf("/"));

- Turn off the visibility of "Details" section of the table, to remove multiple rows
- Display the global variable in the footer section of the group, in a dynamic text

Hope this helps

[Updated on: Thu, 07 November 2013 11:23]

Report message to a moderator

icon14.gif  Re: Concatenating strings with Aggregation Builder issue/question [message #1175176 is a reply to message #1174886] Thu, 07 November 2013 15:23 Go to previous message
Nathan Darby is currently offline Nathan DarbyFriend
Messages: 2
Registered: November 2013
Junior Member
Genius...It worked great.

That's the first time I've ever used a Global Variable.

Thank you so much. That was driving me CRAZY.

[Updated on: Thu, 07 November 2013 15:24]

Report message to a moderator

Previous Topic:how to create datewise table?
Next Topic:Dynamic HTML Links
Goto Forum:
  


Current Time: Sun Dec 08 17:00:31 GMT 2024

Powered by FUDForum. Page generated in 0.07052 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top