Footer and last item on page
bank_holdup
Member Posts: 10
I'm generating a report of our items for a catalog-type print out. Each page has an alphabetical listing of items and all the information comes from the Item card. What I want to do is display a footer for each page that shows the first item on the page and the last item on the page (kind of like in a dictionary). So that when flipping through it, a person can easily see where they are in the catalog. I can get the first item, no problem. But the last item eludes me. Whether I try displaying it directly on a transfooter or a footer, it ALWAYS shows the value for the first listing on the NEXT page. Even if I try using a variable and setting the value to display in the body of the report, I always get the first value from the NEXT page.
Has anyone else run into an issue like this? I did search for similar problems but most of the results I found had to do with summing totals on a page; not what I need to accomplish.
Thanks in advance!
Scott
Has anyone else run into an issue like this? I did search for similar problems but most of the results I found had to do with summing totals on a page; not what I need to accomplish.
Thanks in advance!
Scott
0
Comments
-
Try something like this... Add a global variable, type Code20, call it 'LastItemNumber'. The last line in your Item's OnAfterGetRecord trigger should say:
LastItemNumber := Item."No.";
Then put a textbox in the transfooter with SourceExpr LastItemNumber.0 -
Thanks for the suggestion, but no dice. We deal in books, so I'm actually displaying author's names here. But the principle is the same. I assigned the author's name to a variable as the last statement in the OnAfterGetRecord trigger. When I ran the report, I have one page that ends on ALLE-CORLISS, but the bottom shows it going to ALLEN, which is the first author on the next page.0
-
Is the Number of lines on a page always the same?
I was thinking doing a count on a second item dataitem that just shows the output every x amount of lines. Just brainstorming, nothing solid.
I would be surprised if the Transfooter is what you need to use. It's purpose I thought was to show the first line of the next page :shock:0 -
I suggest adding code to the OnPreSection footer trigger to create a new table variable, duplicate the range of records used in the report and point to the previous record... something like this...
1. Create a table (type record) variable for the same data item used in the report, just with a different name.
2. In the OnPreSection() trigger of the footer, setup this table with an identical query as in the report, point to the current record for the report, then point to the previous record and assign author to a variable to display in the footer. Something like this.DataItemTableCopy2.RESET; DataItemTableCopy2.SETCURRENTKEY(...same as for original data item); DataItemTableCopy2.COPYFILTERS(DataItemTable); DataItemTableCopy2 := DataItemTable; DataItemTableCopy2.NEXT(-1); LastAuthoronPage := DataItemTableCopy2."Author";
If there are other conditions elsewhere in the report which hide records thus adding filters, you may need to repeat conditions or actually run a parallel data item to keep track of the previous record.
Hope this makes sense.Regards,
Bob
NY0 -
Savatage wrote:Is the Number of lines on a page always the same?
I was thinking doing a count on a second item dataitem that just shows the output every x amount of lines. Just brainstorming, nothing solid.
I would be surprised if the Transfooter is what you need to use. It's purpose I thought was to show the first line of the next page :shock:
The report is not guaranteed to have the same number of lines per page, so a simple counter will not work, unfortunately.
Maybe I am mistaken but I was under the impression that a Transfooter was a "transitional" footer and the purpose was to show bottom of the current page info, like current page number, subtotals and the like. Out of curiousity, why would you need a special section to see the data you are about to see in the next body?0 -
BobNY wrote:I suggest adding code to the OnPreSection footer trigger to create a new table variable, duplicate the range of records used in the report and point to the previous record... something like this...
1. Create a table (type record) variable for the same data item used in the report, just with a different name.
2. In the OnPreSection() trigger of the footer, setup this table with an identical query as in the report, point to the current record for the report, then point to the previous record and assign author to a variable to display in the footer. Something like this.DataItemTableCopy2.RESET; DataItemTableCopy2.SETCURRENTKEY(...same as for original data item); DataItemTableCopy2.COPYFILTERS(DataItemTable); DataItemTableCopy2 := DataItemTable; DataItemTableCopy2.NEXT(-1); LastAuthoronPage := DataItemTableCopy2."Author";
If there are other conditions elsewhere in the report which hide records thus adding filters, you may need to repeat conditions or actually run a parallel data item to keep track of the previous record.
Hope this makes sense.
I understand the concept and why it should work, but that seems like a lot of overhead to get a single piece of uncalculated data that I just had my hands on. We have almost 1.5 million distinct items and of those between 40,000 and 50,000 will be in the catalog. That seems like a lot of records to put into a temp table, especially given the data I want to access.0 -
It seems that by the time it prints the footer it already processed the next record, including the OnAfterGetRecord trigger code, so you'll have to keep track of the one before the last.bank_holdup wrote:Thanks for the suggestion, but no dice. We deal in books, so I'm actually displaying author's names here. But the principle is the same. I assigned the author's name to a variable as the last statement in the OnAfterGetRecord trigger. When I ran the report, I have one page that ends on ALLE-CORLISS, but the bottom shows it going to ALLEN, which is the first author on the next page.
What about keeping track of the last and the second to last. Add two variables 'LastName' and 'SecondToLastName'. Set SecondToLast to Last, and set Last to the name in the current record. I don't know how else to capture it.0 -
While it might work, it is going to probably cause big performance issues. You should make it a rule to not use any data processing code to section triggers unless you really don't have any other choice.BobNY wrote:I suggest adding code to the OnPreSection footer trigger0 -
DenSter wrote:It seems that by the time it prints the footer it already processed the next record, including the OnAfterGetRecord trigger code, so you'll have to keep track of the one before the last.
Is it me or does that seem odd? That when the footer of page 1 is being processed, the header & body of page 2 has already been processed.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
