Jasper else case does not match if dataprovider is null

Questions and answers on developing, deploying and using plugins and JavaBeans

Jasper else case does not match if dataprovider is null

Postby deezzub » Fri Apr 11, 2014 11:31 am

I pass a foundset to a Jasper report and in iReport I use the following expression, where is $F{mahnung} declared as Integer in iReport and in Servoy as type Number.:

Code: Select all
$F{mahnung} == 1 ? 1
: $F{mahnung} == 2 ? 2
: $F{mahnung} == 3 ? 3
: -1


The expression works for 0,1,2 and 3, but not for null. If the dataprovider is null, I don't get the desired result -1.

Is this problem, because I pass a foundset to iReport? How can I solve this?
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Jasper else case does not match if dataprovider is null

Postby jasantana » Fri Apr 11, 2014 11:44 am

Add the null condition.

Code: Select all
$F{mahnung} == null ? -1
:$F{mahnung} == 1 ? 1
: $F{mahnung} == 2 ? 2
: $F{mahnung} == 3 ? 3
: -1
Best regards,
Juan Antonio Santana Medina
jasantana@nephos-solutions.co.uk
Servoy MVP 2015
Servoy 6.x - Servoy 7.x - Servoy 8.x - MySQL - PostgreSQL - Visual Foxpro 9
User avatar
jasantana
 
Posts: 555
Joined: Tue Aug 10, 2010 11:40 am
Location: Leeds - West Yorkshire - United Kingdom

Re: Jasper else case does not match if dataprovider is null

Postby deezzub » Fri Apr 11, 2014 2:51 pm

jasantana wrote:Add the null condition.


Hmm, seems to work now. Thanks. I already tried the null check, but it doesn't works before. Is it because it was not in the first line before?
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 24 guests

cron