Jump to content

bucket expression custom object


remmy412

Recommended Posts

I'm trying to use the "wrapper" pattern in order to sort rows in a crosstab.

My bucketExpression is:

<bucketExpression class="com.yestern.jasper.support.RowWrapper"><![CDATA[new com.yestern.jasper.support.RowWrapper($F{TimePeriodName}, $F{PeriodSequence})]]></bucketExpression>

RowWrapper checks the two args for null:

public RowWrapper(String label, Integer order) {
        if (label == null) {
            throw new IllegalArgumentException("label must not be null");
        }
        if (order == null) {
            throw new IllegalAccessError("order must not be null");
        }
        this.label = label;
        this.order = order;
    }

Running this report results in: java.lang.IllegalArgumentException: label must not be null

Now, if I uset a bucketExpression of:

<bucketExpression><![CDATA[$F{TimePeriodName}]]></bucketExpression>

or

<bucketExpression><![CDATA[$F{PeriodSequence}]]></bucketExpression>

The report runs fine. Thoughts?

P.S. I've also tried the bucketExpressions of (not that it should make a difference) and got the same "label must not be null" error:

<bucketExpression class="com.yestern.jasper.support.RowWrapper">new com.yestern.jasper.support.RowWrapper($F{TimePeriodName}, $F{PeriodSequence})></bucketExpression>

 

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Found a way to make it work:

<bucketExpression class="com.yestern.jasper.support.RowWrapper"><![CDATA[new com.yestern.jasper.support.RowWrapper($F{TimePeriodName}.toString(), $F{PeriodSequence}.intValue())]]></bucketExpression>

I don't know nearly enough to explain why it works, it just does. I got the idea to use this pattern from this thread: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=7449 It's the second option explained.

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