AK.
AK.

Reputation: 21

JasperReports Text Field Expression doesn't really let me put in anything except a variable or field reference

Referencing the page number variable in JasperReport as $V{PAGE_NUMBER}. Of course that works fine. However, I would like this report to have a page number preceded by a letter, as in:

A-1
A-2
...
A-N

Unfortunately, this does not appear to be permitted. Even when I get the expression editor to accept an expression, it still fails to compile. Always with "cannot cast from String to Integer", or "cannot cast from Integer to String" errors, or sometimes both.

"A-".concat($V{PAGE_NUMBER}.toString()) does not work. No possible variation works, mystifyingly.

Upvotes: 1

Views: 6219

Answers (2)

mohdajami
mohdajami

Reputation: 9690

Just a note, you can write it as "A-" + $V{PAGE_NUMBER}

Upvotes: 4

AK.
AK.

Reputation: 21

Yeah, you can't teach smart. I neglected to change the field type from Integer to String. And I was about to disparage an awesome free product. D'Oh.

Upvotes: 1

Related Questions