How to change expression use in jaspersoft?

Stimulsoft Ultimate discussion
Post Reply
s0930204
Posts: 3
Joined: Fri Aug 05, 2022 12:57 am

How to change expression use in jaspersoft?

Post by s0930204 »

I want to change my jasper report to stimulsoft report
How to change this expression ?

Code: Select all

(new Float($F{A}.floatValue()*$F{B}.floatValue())).toString().equals("Infinity")?new Float(0):
(new Float($F{A}.floatValue()*$F{B}.floatValue())).toString().equals("NaN")?new Float(0):
(new Float($F{A}.floatValue()*$F{B}.floatValue()))
I try many times but it doesn't work in stimulsoft
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: How to change expression use in jaspersoft?

Post by Lech Kulikowski »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more detail?
What does that expression mean in the jasper report?

Thank you.
s0930204
Posts: 3
Joined: Fri Aug 05, 2022 12:57 am

Re: How to change expression use in jaspersoft?

Post by s0930204 »

I want to write the same expression as jasper report in stimulsoft text expression
Attachments
1660006740650.jpg
1660006740650.jpg (254.33 KiB) Viewed 1725 times
1660006760978.jpg
1660006760978.jpg (69.72 KiB) Viewed 1725 times
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: How to change expression use in jaspersoft?

Post by Lech Kulikowski »

Hello,

We do not know jasper's expressions.
Could you explain your issue in more detail? What does that expression mean in the jasper report?

Thank you.
s0930204
Posts: 3
Joined: Fri Aug 05, 2022 12:57 am

Re: How to change expression use in jaspersoft?

Post by s0930204 »

The expression of jasper report is like the text expression of stimulsoft report.
And it's using java language.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: How to change expression use in jaspersoft?

Post by Lech Kulikowski »

Hello,

You can use calculations in the expression as you need:
{datasourceName.columnName1 * datasourceName.columnName2 + datasourceName.columnName3 - ....}
https://www.stimulsoft.com/en/documenta ... er-manual/

Thank you.
Lord
Posts: 1
Joined: Wed Dec 07, 2022 5:53 am

Re: How to change expression use in jaspersoft?

Post by Lord »

I want to change my jasper report to Stimulsoft report
How to change this expression?

<code>$F{Total}.divide($V{Total},2,RoundingMode.HALF_UP)
</code>

In Stimulsoft Reports, you can use the Round function to achieve the same result as the expression above:
<code>Round($F{Total} / $V{Total}, 2, MidpointRounding.ToEven)
</code>
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: How to change expression use in jaspersoft?

Post by Lech Kulikowski »

Hello,

You can use functions from the Dictionary -

decimal Round (decimal value, int decimals)
Rounds a decimal value to the nearest integer.
Parameters
value - A decimal number to be rounded.
decimals - The number of significant decimal places (precision) in the return value.

Also, in the NET-based products, you can use any NET Framework functions, fox example - Math.Round()

Thank you.
Post Reply