Serhiy
Serhiy

Reputation: 21

Comparing two strings with Jasper inner function EXACT

When I try to compare two values I have an error

ERROR PrintJasperService:338 - net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: //EXACT($P{id}, "14" ) ? "FLASH" :$P{name}

$P{id} I get out from an array: $P{map}.get("{id}")==null? " ":$P{map}.get("{id}") So value of $P{id} can not be NULL. The type of $P{id} is java.lang.String.

I tried compare with 'equals' but got the same error: ERROR PrintJasperService:338 - net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $P{id}.equals("14") ? "FLASH" :$P{name}

What I do wrong?

Upvotes: 0

Views: 1306

Answers (1)

dada67
dada67

Reputation: 5093

Declaring the parameter as java.lang.String would not convert the value to String, you'll need to make sure that the parameter expression evaluates to a String.

You can use something like this:

$P{map}.get("{id}")==null? " ":$P{map}.get("{id}").toString()

Upvotes: 0

Related Questions