Jump to content

Display fields inside crosstab cells


tmagalhaes

Recommended Posts

Hello everyone,

I'm trying to put together a crosstab report and have to display 3 fields in my row header, a number code, the description corresponding to the code and a second string calculated form the code by the database.

The row is bucketed along the code query field and that value I can show in my row header simply referring the bucket name variable.
The other two values are the problem.

I can't simply display $F{FIELD_NAME} inside the row header since the query fields are not visible in that context.
I tried creating Measures pointing to the fields I want with a Nothing calculator, but that simply displays null in every row, instead of the correct values.

So, is there any way to produce with the following data table

CODE_ASDF DESC_ASDF CALC_ASDF OTHER_QUERY_COLUMNS...
1         ABC       FOO
1         ABC       FOO
1         ABC       FOO
24        X         BAR
24        X         BAR

A report with row headers like this:
1   ABC    FOO     Crosstab detail cell data goes here
24  X      BAR     Crosstab detail cell data goes here
?

Thanks in advance

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

 Ok, ended up being able to work around the issue.

Since I know the 3 fields will be unique for each bucket I want to print, instead of bucketing on a single field I defined the group expression as
String.valueOf($F{CODE_ASDF})
+ "~" +
String.valueOf($F{DESC_ASDF})
+ "~" +
String.valueOf($F{CALC_ASDF})

and in each of the fields where I wanted to use a value

$V{GROUP}.split("~")[0] for CODE_ASDF
$V{GROUP}.split("~")[1] for DESC_ASDF
$V{GROUP}.split("~")[2] for CALC_ASDF

I actually put helper methods to do this stuff in my Scriptlet, but this is the basic idea.
A little ugly and not very readable, but it works...

Link to comment
Share on other sites

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...