Sunday, March 25, 2012

Computing and assigning a value to a textbox from other data regions

I am new to SSRS, so perhaps its a trivial question. I was wondering that since all controls have names in the report, is it possible to programatically access values of different textboxes, do some computation and then assign to another text box? I know how to do it using the Aggregate functions and operators, but am not sure if I can access values from textboxes within two different tables and assign the computed value to a third text box on the page (not belonging to any table or other control).

somethig like.... txtTotal.Value = FormatCurrency(txtSalesTotal.Value) - txtDiscount.Value));

Any ideas?

DNG.

People!!!!!!!!!!!

How can I add values in two text boxes and display in the third one? Apparently I can't do this simple thing in SSRS or may be I am missing something? I remember you can do this in Crystal by accessing textbox control and can access their values to be used elsewhere on the page. Can we create variables, where I can store the value of a text box and use it later in other text boxes?

Plz. help!!!

DNG

|||

Let's see if I understand what you are asking. TextBox1 has the sum of values from DataSet1. TextBox2 has the sum of values from DataSet2. These text boxes are not in a table. To sum the value you would need the following in the expression of textbox3:

Code Snippet

=reportitems!TextBox1.Value + reportitems!TextBox2.Value

Hope this helps.

Simone

|||If any of these textboxes are in tables (which I believe you may have mentioned) then you can only reference items within the same scope and you will receive errors.|||

I should add that in the above case, you can use the expression contained within the first two text boxes to give you the value in the 3rd.

ex. TextBox3 expression =

Code Snippet

=Sum(Fields!Value.Value, "dsTest") + Sum(Fields!Value.Value, "dsTest2")

Simone|||Thanks for your help.sqlsql

No comments:

Post a Comment