Jump to content
We've recently updated our Privacy Statement, available here ×

2つの列の掛け算結果を表示する


handcri

Recommended Posts

JasperReportsで2つの列の掛け算結果を表示するには、以下のステップを実行します。

  1. 場所を決める: 最初に、掛け算結果を表示したい位置を決定します。例えばDetailセクションやColumn Footerセクションなどが選択できます。

  2. テキストフィールドを追加: その位置に新しいテキストフィールドを追加します。これは、JasperReportsのデザインビューでドラッグ&ドロップで行うことができます。

  3. Expressionを書く: テキストフィールドをダブルクリックしてExpression Editorを開きます。ここに2つのフィールドを掛け合わせる式を書きます。例えば、フィールドがpriceとquantityであれば、式は ($F{price}).doubleValue() * ($F{quantity}).doubleValue() となります。

これで、2つの列(この例ではpriceとquantity)の掛け算結果が表示されるようになります。ただし、priceとquantityがnullの場合にはNullPointerExceptionが発生するため、nullチェックを行うなど、実際のデータを考慮した実装が必要になるでしょう。

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.
 

Link to comment
Share on other sites

Hello Hancri,

Thank you for your contribution here. If my translator works well, I don't see a question here, if you indeed intended to create a knowledge-based article, you would need to create it under the knowledge-based section.

Thank you,

Raphaël 

Edited by taille60
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...