问题
We are trying to force a morphX report to be an even number of pages in length (so our auto-folding machine can handle the workload properly) and have been unsuccessful in using element.pagesTotal()
to do so.
How have others gotten a page count for per-entity reports at the element level?
(this is dynamics ax 2009)
回答1:
Sorry, but pagesTotal
is a "magic" function that delivers the result after the report has finished, which is too late for you to emit a newPage
.
You will have to count yourself. Luckily X++ is quite good at it!
Declare your counter in classDeclaration
:
Counter pc;
Increment your counter in a page header execute
section:
pc++;
In fetch add your newPage
after super() (or on break of customer number):
boolean fetch()
{
boolean ret = super();
if (pc mod 2 == 1)
element.newPage();
return ret;
}
来源:https://stackoverflow.com/questions/14590986/how-to-count-report-pages-in-pre-rendered-morphx-report