Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Displaying group header on left side of detail instead of over it
icon5.gif  Displaying group header on left side of detail instead of over it [message #759933] Wed, 30 November 2011 15:37 Go to next message
Francis Chabot is currently offline Francis ChabotFriend
Messages: 3
Registered: November 2011
Junior Member
Hi!

First i want to say that i'm new to Birt (my cie used Oracle Report before migrating to Birt) so my question might be really n00b and if it is the case then my apology. Also i'm french so sorry for my bad english Very Happy

I have this report :

|----------------------------------------------------------------------------|
| Nom de l'établissement | Division | Substances produites | Région | Taille |
|----------------------------------------------------------------------------|
| [NM_COMPA] ............................................................... |
|----------------------------------------------------------------------------|
| ...................... | [NM_DIV] | [NM_SUB].............| [REG]. | [TAIL] |
|----------------------------------------------------------------------------|
| ...................... | [NM_DIV] | [NM_SUB].............| [REG]. | [TAIL] |
|----------------------------------------------------------------------------|


The first line is the header of the body table, the second line is a group on the company id displaying the company name, the third line is the detail rows of the body table containing the company divisions name and general informations about them.

The result not formated gives this :


Nom de l'établissement Division ....... Substances produites Région Taille
2537-1253 Québec inc. header filler header filler ...................
...................... ................ Sable et gravier ... 09 ... A
2551-9786 Québec inc. header filler header filler ...................
...................... test madeleine . .................... 03 ... B
...................... test divisionm . Argent, Amiante .... 01 ... A


The problem is the client would like to have the company name and info (group header) displayed on the left side of the detail rows instead of over it. So basically the first column containing the company name and info should span over all the rows of the detail for a company.

Something like this :

|----------------------------------------------------------------------------|
| Nom de l'établissement | Division | Substances produites | Région | Taille |
|----------------------------------------------------------------------------|
| [NM_COMPA] ........... | [NM_DIV] | [NM_SUB] ........... | [REG]. | [TAIL] |
| ...................... |---------------------------------------------------|
| ...................... | [NM_DIV] | [NM_SUB] ........... | [REG]. | [TAIL] |
|----------------------------------------------------------------------------|


The result not formated should give this :


Nom de l'établissement Division ....... Substances produites Région Taille
2537-1253 Québec inc.. ................ Sable et gravier ... 09 ... A
2551-9786 Québec inc.. test madeleine . .................... 03 ... B
filler header group .. test divisionm . Argent, Amiante .... 01 ... A


Is it possible to achieve this using Birt ? And if yes how ?

Thanks in advance for the people who will take the time to answer my question.
.

[Updated on: Wed, 30 November 2011 15:56]

Report message to a moderator

Re: Displaying group header on left side of detail instead of over it [message #760035 is a reply to message #759933] Thu, 01 December 2011 03:18 Go to previous messageGo to next message
karvesh ghunsam is currently offline karvesh ghunsamFriend
Messages: 95
Registered: July 2011
Member
Bonjour Francis,

it is possible. I tried it the following way:

Create a report variable called say, varEtablissement and set its default value to say -1.

Now, in the column where you want the name of Etablissement to appear, add a dynamic text control and set it to HTML and Dynamic text.

Then add the following code:

<VALUE-OF>
if(vars["varEtablissement "] != row["NM_COMPA"])
{
vars["varEtablissement "] = row["NM_COMPA"];
row["NM_COMPA"];
}
else
{
"";
}

</VALUE-OF>


It is a simple code that will execute in the dynamic text variable that tells to display the company name each time a different one appear. For every next similar occurences only blank is returned.

Dont forget to sort the dataset by the column NM_COMPA

Hope it helps..
A+
Re: Displaying group header on left side of detail instead of over it [message #760223 is a reply to message #760035] Thu, 01 December 2011 16:06 Go to previous messageGo to next message
Francis Chabot is currently offline Francis ChabotFriend
Messages: 3
Registered: November 2011
Junior Member
Hi karvesh,

Thanks for your reply.

The code you wrote effectively allow the name and informations of the company to appear one time only. But it doesn't merge the cells of the first colum together.

I probably over simplified the problem. Sorry about that. The name of the company will appear but informations like phone number, fax number and street address will appear too. Those informations might be set or be null in the database so the first column might span over multiple lines or simply one line.

|----------------------------------------------------------------------------|
| Nom de l'établissement | Division | Substances produites | Région | Taille |
|----------------------------------------------------------------------------|
| [NM_COMPA] ........... | [NM_DIV] | [NM_SUB] ........... | [REG]. | [TAIL] |
| [PHONE_BN]............ |---------------------------------------------------|
| [STR_ADDR]............ | [NM_DIV] | [NM_SUB] ........... | [REG]. | [TAIL] |
|----------------------------------------------------------------------------|


With your code the result not formated will give this :

Nom de l'établissement Division ....... Substances produites Région Taille
2537-1253 Québec inc.. ................ Sable et gravier ... 09 ... A
418-999-0000 ......... ................ .................... ...... .
1444 rue Maine ....... ................ .................... ...... .
---------------------------- line separator -------------------------
2551-9786 Québec inc.. test madeleine . .................... 03 ... B
555-666-7777 ......... ................ .................... ...... .
1523 ave Andrews ..... ................ .................... ...... .
...................... test divisionm . Argent, Amiante .... 01 ... A


The last line "...................... test divisionm . Argent, Amiante .... 01 ... A" will appear under the company informations. I can't find any property in Birt that would let me dynamically set a rowspan for this first column. Let's say in your code i add a variable varNbDivision to count the number of divisions a company has :


<VALUE-OF>
if(vars["varEtablissement"] != row["NM_COMPA"])
{
vars["varEtablissement"] = row["NM_COMPA"];
vars["varNbDivision"] = 1;
row["NM_COMPA"];
}
else
{
vars["varNbDivision"] = vars["varNbDivision"] + 1;
"";
}
</VALUE-OF>


How could i use this variable varNbDivision to dynamically set a rowspan for the first column ?

[Updated on: Thu, 01 December 2011 16:13]

Report message to a moderator

Re: Displaying group header on left side of detail instead of over it [message #760349 is a reply to message #760223] Fri, 02 December 2011 03:55 Go to previous messageGo to next message
karvesh ghunsam is currently offline karvesh ghunsamFriend
Messages: 95
Registered: July 2011
Member
Hello Francis,

you can achieve this using inner datasets bound to an outer one. The outer one will be your companies and the inner one will be the children rows of the company.

Please check this example in the attached document.

Best of Luck

Karvesh
Re: Displaying group header on left side of detail instead of over it [message #760543 is a reply to message #760349] Fri, 02 December 2011 18:48 Go to previous message
Francis Chabot is currently offline Francis ChabotFriend
Messages: 3
Registered: November 2011
Junior Member
Looks like it's gonna do the trick. Have yet to try it will do on monday but from the pdf this is exactly what i need.

Thank you very much karvesh for your help it's greatly appreciated.
Previous Topic:How to configure ReportEngine Logs when using the Web Viewer
Next Topic:Custom DataSet wizard page
Goto Forum:
  


Current Time: Fri Mar 29 08:51:13 GMT 2024

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

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

Back to the top