How to use If condition in my report?

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.

I have an expression value that returns a quantity, within those quantities it can be a ZERO, what I want is that when $V{carritoreceibos_vR_1} is equal to zero, multiply certain values ​​to zero.

example:

$V{carritoreceibos_vR_1}==0{

Double.valueOf($F{usuariosservicio_recibosVencidos})*0

}else{

Double.valueOf($F{usuariosservicio_recargoAgua}) * Double.valueOf($F{usuariosservicio_recibosVencidos})

}

Sorry for the inconvenience but I don't know English.

soaddark7's picture
Joined: Jan 4 2021 - 6:00pm
Last seen: 2 weeks 6 days ago

1 Answer:

Simply put, I think it can be described by a ternary operator.

$V{carritoreceibos_vR_1}==0?0:$V{carritoreceibos_vR_1}*$F{usuariosservicio_recibosVencidos}

But your requirement is to change the value of 'usuariosservicio_recibosVencidos' itself?
If so, it must be written in the SQL for data retrieval.
However, I don't think we can use $V{carritoreceibos_vR_1} within the SQL.

yama818's picture
2308
Joined: Aug 17 2018 - 3:48pm
Last seen: 10 hours 7 min ago
Feedback