how to transform character in integer

Hello everyone,
If I may, I would like to ask you because I would like to count the active or non-active numbers. This data is characterised by the number of Yes and No per municipality. 
I created a common group and a variable to compatbilise.
I set the variable as follows:
calculation: sum
initial value expression:$F{arret_dorm}.getValue.parseInt(Oui,1)

the problem is that the entire transformation is not happening and I don’t know how else to do it.


solene.masseron's picture
Joined: Mar 9 2021 - 7:38am
Last seen: 1 month 2 weeks ago

2 Answers:


This should actually work as a problem. Your idea behind it is correct:

Depending on the value of the string (yes or no) a 1 or 0 is summed up. This gives the total sum of the records with yes.

I would simply set the Initial Expression to 1. This will be overwritten with the first record anyway.

I would set the Expression to

$F{arret_dom} != null && $F{arret_dom}.exqualsIgnoreCase("oui") ? 1 : 0

Probably your comparison with == leads to a problem. This checks the equality of objects in Java. Two strings can have the same content but be different objects.

Consider also the correct evaluation time of the text field in which you use this variable.

Greetings, Johannes

johannes.held's picture
Joined: Dec 2 2015 - 12:51am
Last seen: 3 weeks 4 days ago

Good morning,

I apologize for my late response time 
I tested your solution. Attached is the picture of the parameters .  I have a problem with my initial text field because I want to convert text to whole .

I can’t convert this field to a whole.
Help =)

PDF icon doc1.pdf239.77 KB
solene.masseron's picture
Joined: Mar 9 2021 - 7:38am
Last seen: 1 month 2 weeks ago