Options

RTC Reports - fields in header

ccbryan63ccbryan63 Member Posts: 115
edited 2013-04-25 in NAV Three Tier
Sorry if this gets involved...

Talking about the VS Layout of reports:

I am having trouble putting a textbox in my report header. Well, not having trouble putting it in, but I can't get it to display anything. Here's the deal:

I understand that you can't put fields in the header directly. If I drag a field from the DataSet Result onto the header, I get an error. I've noticed in various RTC report layouts that the way this is handled is to put the 'field' in the body like this: =Fields!TestVal.value and then REFER to it in the header like this: =ReportItems!TestVal.value. When I use this strategy in the report I'm working on (10075 Sales Order), the text box in the body (=Fields!TestVal.value) displays properly but the text box in the header shows nothing.

Perhaps this has something to do with this particular report, since the base layout has no =ReportItem! fields in the header; they are all =code.GetData(x,x). Maybe there is a setting that suppresses =ReportItems! somehow??

I have checked that my header textbox is set to be visible. I know I'm working with the right report since I have seen my test value in the body. In other reports (with working =ReportItems!xxx in the header), if the corresponding =Fields! textbox is removed, an ERROR shows on the report, but when I try that on 10075, no error message shows. I have demonstrated that I can add *something* to the header by putting in a line, but my test textbox remains obstinately invisible.

I am a hopeless newbie with RTC report layouts, but I'm trying to learn... any ideas??

Thanks in advance,

Chandler

Comments

  • Options
    MarijnMarijn Member Posts: 69
    First, open a default report, let's say 206, and go to the properties of that report. Find the Code property, and copy paste the SetData and GetData functions in your report if you don't have them already. These functions allow to set four global vars, which can be extented later if you need more.

    Second, place a list control which covers all the body area. Make sure it groups on something, like the primary key of the first data-item. Within that list, place a little table with 4 columns. Give the four textboxes of that table a clear name, change the color to red (hidden fields should be red by convention), set the Hidden property to true and CanGrow to false. Then set the expressions of each text element. Something like
    =
    Cstr(Fields!CustAddr7.Value) + Chr(177) +
    Cstr(Fields!CustAddr8.Value)

    Make sure to put a single value on a single row because you will find yourself counting them many times. Try to group logical values together, like CompanyInfo, CustAddr, HeaderFields etc.

    Now, create a report header and put a small textbox in the upper left corner. You need one for every global var. Again, set CanGrow to false and color to red. In the Hidden property, set an expression like =Code.SetData(ReportItems!CompanyAddr.Value,1). CompanyAddr refers to the name of the text element in the table in the body. 1 refers to the global var. Repeat this for the other groups.

    Now, put a text element in the header and set a value like =Code.GetData(2,1). The 2 refers to the rownumber of the expression and the 1 refers to the global var. In this case CustAddr8 will be displayed.

    When designing reports, always check the output with multiple documents and check whether the header will show the correct values.
Sign In or Register to comment.