Jump to content
Changes to the Jaspersoft community edition download ×

Measures in crosstab RowHeader ?


2004 IR Help

Recommended Posts

By: Laurent Coustet - laurentcoustet

Measures in crosstab RowHeader ?

2005-12-22 01:22

Hi,

 

As seen in the documentation, it seems it's possible to use measures in RowGroupHeader in a CrossTab. However, it does not seems to works as measures are defined After RowGroups, so, after RowGroupHeaders.

 

I don't understand how I could put some data in the Header, other than the data used by the BucketExpression ...

 

So, My question is: Is it possible to put "variables" or "fields" in a RowGroup Header ? I need to display some values there ...

 

If not, Is there a trick I could do to accomplish this task ? Or Is it planned to be supported in a next release ?

 

Many thanks,

 

--

Laurent Coustet

 

 

 

 

By: Lucian Chirita - lucianc

RE: Measures in crosstab RowHeader ?

2005-12-22 07:20

Hi

 

How do you want to use measures in group headers? What value do you expect to receive for the measure?

 

If you want to use in a row header a value that comes from outside the crosstab (from the report), you have to use a crosstab parameter to send the value to the crosstab and then use the parameter value in the header. Check the Shipments report sample, it shows how to use crosstab parameters.

 

HTH,

Lucian

 

 

 

 

By: Laurent Coustet - laurentcoustet

RE: Measures in crosstab RowHeader ?

2005-12-22 07:56

In each Cell I've an access to some values defined by a "root node" (I'm using XMLDataSource), which should not be displayed in contentCell, but in the rowHeaderCell. Like a city name, a city post code, the phone number of a contact ...

 

I don't know if i'm comprehensible, and I've found a trick to accomplish the task, modifying the jasperreports source code:

 

In src/net/sf/jasperreports/engine/fill/JRFillCrosstab.java

 

Just after the prepareRowHeader function definition, I've added that uggly unsafe code:

 

CrosstabCell data = cellData[rowIdx + startRowIndex][0];

boolean overflow = prepareDataCell(data, 0, availableHeight, 0);

 

So With that, i'm able to get the values as if it was in the first cell...

 

If you don't understand what I'm trying to do, I could explain more...

 

Thanks,

 

 

 

 

 

 

By: Lucian Chirita - lucianc

RE: Measures in crosstab RowHeader ?

2005-12-22 08:17

Are you using a sub dataset? I'm not sure I understand your case.. Maybe you could explain more.

 

Regards,

Lucian

 

 

 

 

By: Laurent Coustet - laurentcoustet

RE: Measures in crosstab RowHeader ?

2005-12-22 09:15

Ok,

 

My template:

http://rafi.wireless-fr.org/~ed/.pailla.jrxml

 

(I Know i'm using some uggly tricks to display some data there (like 2 fields in the content Cell)

 

And my XML Data file:

 

http://rafi.wireless-fr.org/~ed/.pailla-data.xml

 

I'm using a XMLDataSource, the root XPath used: /Paillasse/corps/demande/colone/test1

 

There is no sub dataset, the crosstab is filled by the main dataset.

 

I Want here to display in the

<rowGroup name="DemandeGroup" width="60">

 

some data providen in <demande> tag. As I said, it's accessible in normal Cells, but not in RowHeaders Cell. For example the $V{patient_nom} or $V{patient_prenom}. The only accessible variable is the one used in the bucketExpression! So I've made the little uggly patch.. :)

 

Do you understand my problem now ?

 

Many thanks,

 

 

 

 

By: Lucian Chirita - lucianc

RE: Measures in crosstab RowHeader ?

2005-12-23 04:07

I think I'm right when I say that the information you want to display in the row header depends on the row group's bucket expression only ($F{demande_id}).

 

What you can do in this case is to create a data class that encapsulates the demande_id value and dependent values (nom, prenom, etc). The class should implement hashCode(), equals() and compareTo() from Comparable based in the ID value.

 

This class should then be used as bucket expression: new Demande($F{demande_id}, $F{nom}, $F{prenom}). In the row header you would do $V{DemandeGroup}.getNom(), etc..

 

We are considering adding value expressions beside the bucket expression in future versions so that using dependent values in crosstab groups would be easier.

 

HTH,

Lucian

 

 

 

 

 

By: Laurent Coustet - laurentcoustet

RE: Measures in crosstab RowHeader ?

2005-12-23 05:35

Ok, Thats a really cleaner way to do what I want.

 

Many, many thanks,

--

Laurent Coustet

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...