locked
Diff between "ReportItems" and "Fields" RRS feed

  • Question

  • Hi All,

    Just want to make sure if below this 2 expression have any difference in its output or it will return the same value while we run the report:-

    For ex, if I have a dataset field called "Amount" and it is residing let s say in TextBox1 , then below two expression will be the same or not?

    1) Fields!Amount.Value

    2) ReportItems!TextBox1.Value

    -Does it matter if I use any of these 2 , will they be considered exactly the same??? Mainly I want to know its impact on any aggregate function for ex, SUM.

    If I have "Amount1" and "Amount2" within "TextBox1" and "TextBox2" respectively. Then does it matter if I use like below ??

     1) Fields!Amount1.Value + Fields!Amount2.Value  

     2) ReportItems!TextBox1.Value  +  ReportItems!TextBox2.Value

    Monday, December 13, 2010 5:04 PM

Answers

  • reportitems holds what ever value is in the textbox while a field is just the column value of a dataset tuple.  The value of a reportitem is not limited to a field value, it can be a parameter value, hard coded value, or an expression that does a calculation on any of them.  It is most often used to reuse the calculation of another textbox without having to retype it out.

    So for example if you you have fields A and fields B and you want one table cell to be =(fields!A.Value + 90) / 2 and another to be  =(fields!A.Value + 90) / 2 - fields!B.Value, then you can reference the value of the first textbox to make the calculation cleaner in the second one like this:

    =ReportItems!TextBox1.Value - fields!B.Value

     

    And to your specific question, yes they will be the same.  It could be useful to use reportitems so incase there's a requirement change, you only change the value of textbox1 but then you if start shifting values into different textbox cells it could mess things up.  I personally rarely use reportitems.

    • Marked as answer by Tony Chain Tuesday, December 21, 2010 1:42 AM
    Monday, December 13, 2010 5:30 PM