How to access text box value in SSRS using ReportItems

Today I am going to share little bit important lesson. But I will hope you have already know this. Most of the times you might be required to access another text box value in Dynamics NAV report layout. For instance, Some times, developers want to show total on the top of the report, Like Total Invoice Value. Also in the body you have calculated the line wise value and you have the total with you. But you cannot show it at the beginning. Now you might be seeking a solution.

You may wondering there is a in built function called ReportItems. Simple and straightforward. The ReportItems includes text boxes that are in the current scope of a page header, footer, or body. This will identify at run time by the report processor/report render.

You may find good example in Microsoft (MSDN) website. So same example I will show here.

This expression, placed in a text box, displays the value of a ReportItem text box named Textbox1:

=ReportItems!Textbox1.Value

This expression, placed in a ReportItem text box Color property, displays the text in black when the value is > 0; otherwise, the value is displayed in red:=IIF(Me.Value > 0,"Black","Red")
This expression, placed in a text box in the page header or page footer, displays the first value per page of the rendered report, for a text box named LastName:

=First(ReportItems("LastName").Value)

Simply use ReportItems then use the textbox value.

Comments

  • zohaibu95@hotmail.comzohaibu95@hotmail.com Member Posts: 223
    Today I am going to share little bit important lesson. But I will hope you have already know this. Most of the times you might be required to access another text box value in Dynamics NAV report layout. For instance, Some times, developers want to show total on the top of the report, Like Total Invoice Value. Also in the body you have calculated the line wise value and you have the total with you. But you cannot show it at the beginning. Now you might be seeking a solution.

    You may wondering there is a in built function called ReportItems. Simple and straightforward. The ReportItems includes text boxes that are in the current scope of a page header, footer, or body. This will identify at run time by the report processor/report render.

    You may find good example in Microsoft (MSDN) website. So same example I will show here.

    This expression, placed in a text box, displays the value of a ReportItem text box named Textbox1:

    =ReportItems!Textbox1.Value

    This expression, placed in a ReportItem text box Color property, displays the text in black when the value is > 0; otherwise, the value is displayed in red:=IIF(Me.Value > 0,"Black","Red")
    This expression, placed in a text box in the page header or page footer, displays the first value per page of the rendered report, for a text box named LastName:

    =First(ReportItems("LastName").Value)

    Simply use ReportItems then use the textbox value.

    You are posting the information as its just like the issue. It misleads the viewers. Please post this type of posts in "How Tos sections" so that i won't confuse the viewers. Thanks
    Best Regards
    Zohaib Ahmed
    Dynamics NAV ERP Technical Consultant.

    please like / agree / verify my answer, if it was helpful for you. thanks.
Sign In or Register to comment.