Hi there,
Is somebody knows, how can I ask Axapta to return cursor position in reports?
Cause' I want to make this:
If a report section larger than empty space on actual page, let's make a page break.
Thanks in advance!
Krisz
Best Regards
Krisztian Hampuk
AX Consultant
0
Comments
I solved it with a little function within the report.
See attachment
Gtrz
OBJECT Report 50100 Sample
{
OBJECT-PROPERTIES
{
Date=24/10/08;
Time=12:39:52;
Modified=Yes;
Version List=;
}
PROPERTIES
{
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table36;
DataItemTableView=SORTING(Document Type,No.)
WHERE(Document Type=CONST(Order));
ReqFilterFields=No.;
}
SECTIONS
{
{ PROPERTIES
{
SectionType=Body;
SectionWidth=13402;
SectionHeight=2301;
OnPreSection=BEGIN
CurrReport.SHOWOUTPUT(CurrReport.PAGENO = 1);
IF CurrReport.SHOWOUTPUT THEN
QuantityPrinted := 0;
END;
}
CONTROLS
{
{ 1000000006;Label ;0 ;0 ;5250 ;423 ;CaptionML=ENU=Sales Header start }
{ 1000000007;Label ;0 ;1878 ;5250 ;423 ;CaptionML=ENU=Sales Header stop }
}
}
}
}
{ PROPERTIES
{
DataItemIndent=1;
DataItemTable=Table37;
DataItemTableView=SORTING(Document Type,Document No.,Line No.)
WHERE(Document Type=CONST(Order));
DataItemVarName=Smaller;
OnAfterGetRecord=BEGIN
QuantityPrinted := QuantityPrinted + 1;
END;
DataItemLink=Document Type=FIELD(Document Type),
Document No.=FIELD(No.);
}
SECTIONS
{
{ PROPERTIES
{
SectionType=Header;
SectionWidth=13402;
SectionHeight=846;
OnPreSection=BEGIN
//The section uses 2 lines thus number of lines must be 2 or more
QuantityPrinted := QuantityPrinted + 2;
END;
}
CONTROLS
{
{ 1000000001;Label ;2752 ;0 ;2690 ;846 ;ParentControl=1000000000;
HorzAlign=Right;
VertAlign=Bottom;
FontBold=Yes;
MultiLine=Yes }
{ 1000000002;Label ;0 ;0 ;2796 ;423 ;CaptionML=ENU=Smaller }
}
}
{ PROPERTIES
{
SectionType=Body;
SectionWidth=13402;
SectionHeight=423;
}
CONTROLS
{
{ 1000000000;TextBox;2841 ;0 ;2584 ;423 ;SourceExpr="Line No." }
}
}
}
}
{ PROPERTIES
{
DataItemIndent=1;
DataItemTable=Table37;
DataItemTableView=SORTING(Document Type,Document No.,Line No.)
WHERE(Document Type=CONST(Order));
DataItemVarName=Bigger;
OnAfterGetRecord=BEGIN
QuantityPrinted := QuantityPrinted + 1;
END;
DataItemLink=Document Type=FIELD(Document Type),
Document No.=FIELD(No.);
}
SECTIONS
{
{ PROPERTIES
{
SectionType=Header;
SectionWidth=13402;
SectionHeight=846;
OnPreSection=BEGIN
//The section uses 2 lines thus number of lines must be 2 or more
QuantityPrinted := QuantityPrinted + 2;
//Because you want the section to not start at the end of a page
IF fctMaxLines(QuantityPrinted) THEN
CurrReport.NEWPAGE;
END;
}
CONTROLS
{
{ 1000000003;Label ;2752 ;0 ;2690 ;846 ;ParentControl=1000000005;
HorzAlign=Right;
VertAlign=Bottom;
FontBold=Yes;
MultiLine=Yes }
{ 1000000004;Label ;0 ;0 ;2796 ;423 ;CaptionML=ENU=Bigger }
}
}
{ PROPERTIES
{
SectionType=Body;
SectionWidth=13402;
SectionHeight=423;
}
CONTROLS
{
{ 1000000005;TextBox;2725 ;0 ;2584 ;423 ;SourceExpr="Line No." }
}
}
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=9020;
Height=3410;
}
CONTROLS
{
}
}
CODE
{
VAR
QuantityPrinted@1000000000 : Integer;
PROCEDURE fctMaxLines@1000000001(lintLineNo@1000000000 : Integer) : Boolean;
VAR
lintMaxAmountLines@1000000001 : Integer;
BEGIN
IF CurrReport.PAGENO = 1 THEN
lintMaxAmountLines := 3
ELSE
lintMaxAmountLines := 45;
IF lintLineNo > lintMaxAmountLines THEN
EXIT(TRUE);
//If the number of printed lines exseed the MaxAmountLines value
//the section that called the function shall return the value TRUE
//If the select statement that called the function is TRUE the section will be printed on the a new page.
//For this to work one has to keep track of the Amount "QuantityPrinted" of lines where printed.
END;
BEGIN
END.
}
}
Regards.
K.
Krisztian Hampuk
AX Consultant