I have a really anoying problem and I need your help desperately. The problem is next:
I’m using a transfooter and transheader sections in a report and as it appears they both don’t work correctly. I have 3 data items nested as follows:
In a transfooter I wanna show transfering totals for all 3 DataItems using 3 transfooters for each DataItem, of course. The problem is when a page break occurs. As I understanded the way the Totals work in reports, I can not know the current total/subtotal of a DataItem until report finishes processing of at least one record of that DataItem which implies proccessing it’s nested DataItems to the end, right? What happens is that when, for example, first record of DataItem1 starts on a beginning of a page and with it’s nested DataItems is too large to fit on one page in a transfooter I get zero totals, because report hasn’t finished proccessing at least one record of DataItem1 so he can’t yet tell me any totals!
Have I understood this right? If that’s the case then I don’t see the point of using transfooters unless you calculate the totals manually!
I have a problem with transheader as well. It prints together with the header, even if it started on that page and not the previous one, meaning, there was no transfer!?
If anyone can help, please do, I wellcome any suggestions. Thanks in advance…
I know about all of that you said, that’s not the problem. I’ve put CreateTotals(var1,var2,var3) for each 3 DataItems in their OnPreDataItem Triggers, every one of vars is decimal and any one of the DataItems except the 3rd can spread on more pages. I think the problem is about NAV calculating totals. When the 1st record of a data item starts on a page and transfers to the next page, NAV doesn’t know it’s total because it haven’t calculated it yet (there is not even one record to calculate totals for, because he hasn’t finished processing of that first record! ). Am I being clear enough? Please tell me if I got it right or wrong or if I need to clarify it more.
hm… you’re doing right except one thing that I don’t know. How do you calculate that var?
dataitem is Customer.
on predataitem, CREATETOTALS(Balance);
Now, if you ran report and put footer on the bottom of Customer, on every bottom of page you’ll have “subtotal”, means, what NAV calculated till than (though, I think it has a problem with calculating one more item that “triggered” new page but that is different story).
Same will be with TransferFooter if it happens (means, your dataitem section for one customer record is in more than one part, more sections per that item).
hmm… I’m totally lost. Where have you set CREATETOTALS command (on which dataitem(s)) ? And when you say that you get 0 total, on wich dataitem appears (and with wich CreateTotals is calculated).
Totals and grouping sections are kind of troubled to understand but they do what they are meant to do, believe me. It is just a metter of right combination of createtotals, group/transfer headers/footers…
And, yes, sometimes you cannot achieve what you need to achieve, than you do it manually ( a := a+b;)
IF TransSalesEntry.FINDFIRST THEN BEGIN
CouponSalesQty += -TransSalesEntry.Quantity;
CouponSalesAmount += -TransSalesEntry.“Total Rounded Amt.”;
CouponDiscountAmount += TransSalesEntry.“Infocode Discount”;
UNTIL TransSalesEntry.NEXT = 0;
Now you’ll probably think why I didn’t use grouping but this way I get a prettyer look of a report, if you know what I mean…
When the 1st coupon starts to process there are to many data for stores and items to fit on the first page, so the page break happens. Report detects the page break for the 1st coupon and in the transfooter of the Coupon DataItem it wants to write subtotals, for all the coupons so far, but the report doesn’t know any totals because it haven’t calculated them yet, not even for one coupon (the 1st one)! Understand?
I’ve told you I have CreateTotals for each 3 DataItems… Thanks anyway, I just want to see if there is a way around this unpleasent behaviour with totalling, and if the answer is to manually do the totalling, then it means that you can not have totals and transfooters at same time, because there’s a high probability of a page break in a wrong moment!
Maybe you can help me with the other problem I’ve mentioned, transheaders?
There is one great problem in such reports… NAV somehow has to calculate or reserve space for a page. If you have some dataitems that will not be printed (due to CurrReport.SHOWOUTPUT(FALSE)) NAV will still calculate it (as wasted space) cause he doesn’t know what will be the next C/AL command.
Do you have a lot of dataitems that are ruled by showoutput commands?
Have you separeted DataItems with “Keep with next = FALSE” (Cause this, often, maid a lot of trouble in report layout desing)?
Yeah, that space calculation makes sense. I have SHOWOUTPUT(SomeBooleanExpresion) in Coupon and Store headers, transheaders, footers and transfooters, I use it to hide them when I run the report in a “Summary View” - Summarizes sales by not specifying coupons and stores, it just shows list of all items that were sold, with their CouponSalesQty, CouponSalesAmount and CouponDiscountAmount, for all of the stores and coupons.
Can you please explain me the use of KeepWithNext property? I’ve tried to use it but I didn’t manage to get any seamless result, so I don’t know how it works! And the Help isn’t much helpfull on that topic…
KeepWithNext keeps separeted sections in blocks. If you have 2 dataitems and you want to keep them together on one page then, on the first one you set KeepWithNext = TRUE and on PageBreak if both sections cannot fit to one page, both will be transfered to next page.
NAV set KeepWithNext to YES by default but it works only with the same sections, e.g., Body sections 1 to 5 of DataItem1 or GroupFooter sections 1 to 3 of DataItem4. I think, I’m not sure, to be honest.
Implications are, NAV has to calculate space for these linked sections too so, if you don’t have a need for sections to be together, remove KeepWithNext to avoid unnecessary calculations wich could bring you problems in design of layouts.