adding two values from two textboxes

Stimulsoft Reports.NET discussion
ddsmith99301
Posts: 52
Joined: Wed May 17, 2017 10:14 pm

adding two values from two textboxes

Post by ddsmith99301 »

I have two textboxes on the report. I would like to add the two numbers and put the total in a third textbox. How do I do it?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: adding two values from two textboxes

Post by Alex K. »

Hello,

You can use expressions from first and second text component in the third textbox:
{Text1expression + Text2expression}

Thank you.
shiva
Posts: 4
Joined: Mon Jul 08, 2019 8:58 pm

Re: adding two values from two textboxes

Post by shiva »

To understand better is the above solution valid even if the expressions which are being added are like sumif{} derived by using summary.
Lech Kulikowski
Posts: 6252
Joined: Tue Mar 20, 2018 5:34 am

Re: adding two values from two textboxes

Post by Lech Kulikowski »

Hello,

You can use an additional variables in text expression where sumif are used:
{Variable1 = SumIf()} {Variable2 = SumIf()}
and then use
{Variable1 + Variable2}

Thank you.
ddsmith99301
Posts: 52
Joined: Wed May 17, 2017 10:14 pm

Re: adding two values from two textboxes

Post by ddsmith99301 »

Lech, please give an example of where to set the two variables and when to use them. I have a group band and a databand. I put textboxes in the group band with expressions that use Sumif. I would like to use the two variables added to gather to put in the third textbox.
Lech Kulikowski
Posts: 6252
Joined: Tue Mar 20, 2018 5:34 am

Re: adding two values from two textboxes

Post by Lech Kulikowski »

Hello,

Please check the sample report.

Thank you.
Attachments
ReportSample.mrt
(793.61 KiB) Downloaded 80 times
ddsmith99301
Posts: 52
Joined: Wed May 17, 2017 10:14 pm

Re: adding two values from two textboxes

Post by ddsmith99301 »

I tried everything to get this to work. I can't figure out what I am doing wrong. Why is the text box output 'False' where I am trying to set the VB2 variable?

Here is the designer.
2022-12-28_21-23-27.png
2022-12-28_21-23-27.png (129.62 KiB) Viewed 1183 times
Here is the output.
2022-12-28_21-17-55.png
2022-12-28_21-17-55.png (27.45 KiB) Viewed 1183 times
Lech Kulikowski
Posts: 6252
Joined: Tue Mar 20, 2018 5:34 am

Re: adding two values from two textboxes

Post by Lech Kulikowski »

Hello,

What script language is used for the report? Please try to set it to CSharp.

Thank you.
ddsmith99301
Posts: 52
Joined: Wed May 17, 2017 10:14 pm

Re: adding two values from two textboxes

Post by ddsmith99301 »

I found the option to change to c# script. That seemed to have worked. So, my conclusion is the vb scripting doesn't work. I am using ver 2019.3.1. Has that been fixed in later versions?
ddsmith99301
Posts: 52
Joined: Wed May 17, 2017 10:14 pm

Re: adding two values from two textboxes

Post by ddsmith99301 »

I said before that it worked but there is a cost. Now I have 300+ errors!
Post Reply