my report is loading slow for the first time. but it is loading faster for the second or third time.
how can i solve this issue?
OBJECT Report 50017 Adjustments
{
OBJECT-PROPERTIES
{
Date=19.01.12;
Time=16:19:53;
Modified=Yes;
Version List=Monir;
}
PROPERTIES
{
OnPreReport=BEGIN
IF PrintToExcel THEN
MakeExcelInfo;
END;
OnPostReport=BEGIN
IF PrintToExcel THEN
CreateExcelbook;
END;
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table32;
DataItemTableView=SORTING(Item No.)
ORDER(Ascending);
OnPreDataItem=BEGIN
IF( Barcode<>'') THEN BEGIN
// Item.SETRANGE(Item."No.", Barcode) ;
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Item No.", Barcode);
END;
IF( DocumentNo<>'') THEN BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Document No.",DocumentNo) ;
END;
IF( Warehouse<>'') THEN BEGIN
"Item Ledger Entry".SETFILTER("Item Ledger Entry"."Location Code", '=%1', Warehouse) ;
// "Item Ledger Entry".SETRANGE("Item Ledger Entry"."Location Code", Warehouse) ;
END;
IF(( PositiveValue=TRUE) AND ( NegativeValue=FALSE)) THEN BEGIN
"Item Ledger Entry".SETFILTER("Entry Type", '=%1',"Item Ledger Entry"."Entry Type"::"Positive Adjmt.");
END;
IF (( PositiveValue=FALSE)AND ( NegativeValue=TRUE)) THEN BEGIN
"Item Ledger Entry".SETFILTER("Entry Type", '=%1',"Item Ledger Entry"."Entry Type"::"Negative Adjmt.");
END;
IF (( PositiveValue=TRUE)AND ( NegativeValue=TRUE)) THEN BEGIN
"Item Ledger Entry".SETFILTER("Entry Type", '=%1|=%2',"Item Ledger Entry"."Entry Type"::"Positive Adjmt.",
"Item Ledger Entry"."Entry Type"::"Negative Adjmt.");
END;
IF (( PositiveValue=FALSE)AND ( NegativeValue=FALSE)) THEN BEGIN
"Item Ledger Entry".SETFILTER("Entry Type", '=%1|=%2',"Item Ledger Entry"."Entry Type"::"Positive Adjmt.",
"Item Ledger Entry"."Entry Type"::"Negative Adjmt.");
END;
// IF ("Negative Adjmt." =TRUE) THEN BEGIN
// END;
"Item Ledger Entry".SETCURRENTKEY("Item Ledger Entry"."Item No.","Item Ledger Entry"."Location Code");
// "Item Ledger Entry".SETCURRENTKEY("Item Ledger Entry"."Item No.");
"Item Ledger Entry".ASCENDING(TRUE) ;
//window.OPEN('
@\',intProgress);
// timProgress := TIME;
Number := "Item Ledger Entry".COUNT;
END;
OnAfterGetRecord=BEGIN
// ItemBarcode:="Item Ledger Entry"."Item No.";
CLEAR( CurrentBarcode);
CLEAR( CurrentLocationCode);
CurrentBarcode:= "Item Ledger Entry"."Item No." ;
CurrentLocationCode:="Item Ledger Entry"."Location Code";
END;
OnPostDataItem=BEGIN
// window.CLOSE;
END;
GroupTotalFields=Item No.,Location Code;
}
SECTIONS
{
{ PROPERTIES
{
SectionType=Header;
SectionWidth=23250;
SectionHeight=846;
OnPreSection=BEGIN
IF PrintToExcel THEN BEGIN
CurrReport.SHOWOUTPUT:=FALSE;
END ELSE BEGIN
CurrReport.SHOWOUTPUT:=TRUE;
END;
END;
}
CONTROLS
{
{ 1000000010;Label ;2100 ;0 ;2550 ;423 ;HorzAlign=Left;
CaptionML=ENU=Negative/Positive }
{ 1000000011;Label ;6300 ;0 ;2100 ;423 ;HorzAlign=Left;
CaptionML=ENU=Barcode }
{ 1000000013;Label ;11400;0 ;1950 ;423 ;HorzAlign=Left;
CaptionML=ENU=Warehouse }
{ 1000000014;Label ;15150;0 ;1800 ;423 ;HorzAlign=Left;
CaptionML=ENU=Cost }
}
}
{ PROPERTIES
{
SectionType=GroupFooter;
SectionWidth=23250;
SectionHeight=846;
OnPreSection=BEGIN
IF CurrReport.TOTALSCAUSEDBY = "Item Ledger Entry".FIELDNO("Item Ledger Entry"."Location Code") THEN BEGIN
//IF CurrReport.TOTALSCAUSEDBY = "Item Ledger Entry".FIELDNO("Item Ledger Entry"."Item No.") THEN BEGIN
CurrReport.SHOWOUTPUT(FALSE);
END ELSE BEGIN
CurrReport.SHOWOUTPUT(PositiveValue<>FALSE);
END;
END;
}
CONTROLS
{
{ 1000000000;TextBox;14550;0 ;3750 ;423 ;HorzAlign=Left;
SourceExpr=Unitcost }
{ 1000000001;TextBox;11100;0 ;2700 ;423 ;HorzAlign=Left;
SourceExpr="Item Ledger Entry"."Location Code" }
{ 1000000002;TextBox;5850 ;0 ;3900 ;423 ;HorzAlign=Left;
SourceExpr="Item Ledger Entry"."Item No." }
{ 1000000003;TextBox;1800 ;0 ;3150 ;423 ;HorzAlign=Left;
SourceExpr=TotalPositiveQty }
{ 1000000004;Label ;0 ;0 ;1500 ;423 ;HorzAlign=Left;
CaptionML=ENU=Pos. }
}
}
{ PROPERTIES
{
SectionType=GroupFooter;
SectionWidth=23250;
SectionHeight=846;
OnPreSection=BEGIN
IF CurrReport.TOTALSCAUSEDBY = "Item Ledger Entry".FIELDNO("Item Ledger Entry"."Location Code") THEN BEGIN
//IF CurrReport.TOTALSCAUSEDBY = "Item Ledger Entry".FIELDNO("Item Ledger Entry"."Item No.") THEN BEGIN
CurrReport.SHOWOUTPUT(FALSE);
END ELSE BEGIN
CurrReport.SHOWOUTPUT(NegativeValue<>FALSE);
END;
END;
}
CONTROLS
{
{ 1000000005;TextBox;14550;0 ;3750 ;423 ;HorzAlign=Left;
SourceExpr=Unitcost }
{ 1000000006;TextBox;11100;0 ;2700 ;423 ;HorzAlign=Left;
SourceExpr="Item Ledger Entry"."Location Code" }
{ 1000000007;TextBox;5850 ;0 ;3900 ;423 ;HorzAlign=Left;
SourceExpr="Item Ledger Entry"."Item No." }
{ 1000000008;TextBox;1800 ;0 ;3150 ;423 ;HorzAlign=Left;
SourceExpr=TotalNegativeQty }
{ 1000000009;Label ;0 ;0 ;1500 ;423 ;HorzAlign=Left;
CaptionML=ENU=Neg. }
}
}
}
}
{ PROPERTIES
{
DataItemIndent=1;
DataItemTable=Table2000000026;
DataItemTableView=SORTING(Number)
ORDER(Ascending)
WHERE(Number=CONST(1));
DataItemVarName=<IntegerPositive>;
OnPreDataItem=BEGIN
IF (PositiveValue =TRUE) THEN BEGIN
// Item.SETRANGE(Item."No.", Barcode) ;
PositiveItemLedger.RESET;
IF( Barcode<>'') THEN BEGIN
// Item.SETRANGE(Item."No.", Barcode) ;
PositiveItemLedger.SETRANGE(PositiveItemLedger."Item No.", Barcode);
END ELSE BEGIN
PositiveItemLedger.SETRANGE( PositiveItemLedger."Item No.", "Item Ledger Entry"."Item No.");
END;
IF( DocumentNo<>'') THEN BEGIN
PositiveItemLedger.SETRANGE( PositiveItemLedger."Document No.",DocumentNo) ;
END;
IF( Warehouse<>'') THEN BEGIN
PositiveItemLedger.SETFILTER( PositiveItemLedger."Location Code", '=%1', Warehouse) ;
// "Item Ledger Entry".SETRANGE("Item Ledger Entry"."Location Code", Warehouse) ;
END ELSE BEGIN
PositiveItemLedger.SETFILTER( PositiveItemLedger."Location Code", '=%1', "Item Ledger Entry"."Location Code") ;
END;
IF( PositiveValue=TRUE) THEN BEGIN
PositiveItemLedger.SETFILTER("Entry Type", '=%1', PositiveItemLedger."Entry Type"::"Positive Adjmt.");
END;
PositiveItemLedger.SETCURRENTKEY( PositiveItemLedger."Item No.",PositiveItemLedger."Location Code");
// PositiveItemLedger.SETCURRENTKEY( PositiveItemLedger."Item No.");
PositiveItemLedger.ASCENDING(TRUE) ;
"Value Entry".SETRANGE("Value Entry"."Item No.","Item Ledger Entry"."Item No.");
IF( Warehouse<>'') THEN BEGIN
"Value Entry".SETFILTER( "Value Entry"."Location Code", '=%1', Warehouse) ;
END ELSE BEGIN
"Value Entry".SETFILTER("Value Entry"."Location Code", '=%1', "Item Ledger Entry"."Location Code") ;
END;
//END ELSE BEGIN
//CurrReport.BREAK;
END;
END;
OnAfterGetRecord=BEGIN
IF (PositiveValue =TRUE) THEN BEGIN
FooterCount:=0;
CLEAR(TotalPositiveQty);
CLEAR(ToWarehouse);
CLEAR(Unitcost);
WITH PositiveItemLedger DO BEGIN
IF( PositiveItemLedger.FIND('-') )THEN BEGIN
REPEAT
TotalPositiveQty:= TotalPositiveQty+ PositiveItemLedger.Quantity;
//ToWarehouse:=PositiveItemLedger."Location Code";
UNTIL PositiveItemLedger.NEXT=0;
END;
END;
//"Value Entry".SETRANGE("Value Entry"."Item No.", CurrentBarcode);
// "Value Entry".SETRANGE("Value Entry"."Item Ledger Entry No.", "Item Ledger Entry"."Entry No.");
WITH "Value Entry" DO BEGIN
IF( "Value Entry".FIND('-') )THEN BEGIN
REPEAT
Unitcost:= Unitcost+ "Value Entry"."Cost Amount (Actual)";
UNTIL "Value Entry".NEXT=0;
END;
END;
IF PrintToExcel THEN
MakeExcelDataBody;
END;
END;
}
SECTIONS
{
}
}
{ PROPERTIES
{
DataItemIndent=1;
DataItemTable=Table2000000026;
DataItemTableView=SORTING(Number)
ORDER(Ascending)
WHERE(Number=CONST(1));
DataItemVarName=<IntegerNegative>;
OnPreDataItem=BEGIN
IF ( NegativeValue=TRUE ) THEN BEGIN
NegativeItemLedger.RESET;
// Item.SETRANGE(Item."No.", Barcode) ;
IF( Barcode<>'') THEN BEGIN
NegativeItemLedger.SETRANGE(NegativeItemLedger."Item No.", Barcode);
END ELSE BEGIN
NegativeItemLedger.SETRANGE( NegativeItemLedger."Item No.","Item Ledger Entry"."Item No.");
END;
IF( DocumentNo<>'') THEN BEGIN
NegativeItemLedger.SETRANGE( NegativeItemLedger."Document No.",DocumentNo) ;
END;
IF( Warehouse<>'') THEN BEGIN
NegativeItemLedger.SETFILTER( NegativeItemLedger."Location Code", '=%1', Warehouse) ;
// "Item Ledger Entry".SETRANGE("Item Ledger Entry"."Location Code", Warehouse) ;
END ELSE BEGIN
NegativeItemLedger.SETFILTER( NegativeItemLedger."Location Code", '=%1',"Item Ledger Entry"."Location Code") ;
END;
IF(NegativeValue=TRUE) THEN BEGIN
NegativeItemLedger.SETFILTER("Entry Type", '=%1', NegativeItemLedger."Entry Type"::"Negative Adjmt.");
END;
// IF ("Negative Adjmt." =TRUE) THEN BEGIN
// END;
NegativeItemLedger.SETCURRENTKEY( NegativeItemLedger."Item No.",NegativeItemLedger."Location Code");
// NegativeItemLedger.SETCURRENTKEY( NegativeItemLedger."Item No.");
NegativeItemLedger.ASCENDING(TRUE) ;
"Value Entry".SETRANGE("Value Entry"."Item No.","Item Ledger Entry"."Item No.");
IF( Warehouse<>'') THEN BEGIN
"Value Entry".SETFILTER( "Value Entry"."Location Code", '=%1', Warehouse) ;
END ELSE BEGIN
"Value Entry".SETFILTER("Value Entry"."Location Code", '=%1', "Item Ledger Entry"."Location Code") ;
END;
END;
END;
OnAfterGetRecord=BEGIN
IF ( NegativeValue=TRUE ) THEN BEGIN
FooterCount:=0;
CLEAR( TotalNegativeQty );
CLEAR(ToWarehouse);
CLEAR(Unitcost);
WITH NegativeItemLedger DO BEGIN
IF( NegativeItemLedger.FIND('-') )THEN BEGIN
REPEAT
TotalNegativeQty:= TotalNegativeQty+ NegativeItemLedger.Quantity;
// ToWarehouse:=NegativeItemLedger."Location Code";
UNTIL NegativeItemLedger.NEXT=0;
END;
END;
// "Value Entry".SETRANGE("Value Entry"."Item No.",CurrentBarcode);
// "Value Entry".SETRANGE("Value Entry"."Item Ledger Entry No.", "Item Ledger Entry"."Entry No.");
WITH "Value Entry" DO BEGIN
IF( "Value Entry".FIND('-') )THEN BEGIN
REPEAT
Unitcost:= Unitcost+ "Value Entry"."Cost Amount (Actual)";
UNTIL "Value Entry".NEXT=0;
END;
END;
IF PrintToExcel THEN
MakeExcelDataBody;
END;
END;
}
SECTIONS
{
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=11770;
Height=7700;
OnOpenForm=BEGIN
PrintToExcel := FALSE;
PositiveValue:=FALSE;
NegativeValue:=FALSE;
END;
}
CONTROLS
{
{ 1000000000;Label ;880 ;2420 ;3190 ;440 ;InPage=-1;
HorzAlign=Left;
CaptionML=ENU=Warehouse }
{ 1000000001;TextBox;4510 ;2530 ;3850 ;440 ;HorzAlign=Left;
SourceExpr=Warehouse;
TableRelation=Location.Code }
{ 1000000004;Label ;2090 ;5830 ;2090 ;440 ;InPage=-1;
CaptionML=ENU=Print to Excel }
{ 1000000005;CheckBox;4400;5830 ;660 ;440 ;ShowCaption=No;
SourceExpr=PrintToExcel }
{ 1000000002;Label ;880 ;3080 ;3190 ;440 ;InPage=-1;
HorzAlign=Left;
CaptionML=ENU=Document No }
{ 1000000003;TextBox;4510 ;3190 ;3740 ;440 ;SourceExpr=DocumentNo }
{ 1000000006;Label ;770 ;3960 ;3300 ;440 ;InPage=-1;
HorzAlign=Left;
CaptionML=ENU=Entry Type }
{ 1000000007;CheckBox;4510;3960 ;3190 ;440 ;Name=Positive Adjmt.;
ShowCaption=Yes;
HorzAlign=Left;
CaptionML=ENU=Positive Adjmt.;
SourceExpr=PositiveValue }
{ 1000000008;CheckBox;4510;4620 ;3190 ;440 ;Name=Negative Adjmt.;
InPage=-1;
ShowCaption=Yes;
HorzAlign=Left;
CaptionML=ENU=Negative Adjmt.;
SourceExpr=NegativeValue }
{ 1000000009;Label ;880 ;1650 ;3190 ;660 ;HorzAlign=Left;
CaptionML=ENU=Barcode }
{ 1000000010;TextBox;4400 ;1760 ;3850 ;550 ;InPage=-1;
HorzAlign=Left;
SourceExpr=Barcode }
}
}
REQUESTPAGE
{
PROPERTIES
{
}
CONTROLS
{
}
}
CODE
{
VAR
"Sales Shipment Header"
@1000000001 : Record 110;
"Purch. Rcpt. Header"
@1000000002 : Record 120;
"Transfer Shipment Header"
@1000000003 : Record 5744;
Warehouse@1000000000 : Text[30];
ToWarehouse@1000000004 : Text[30];
PrintToExcel@1000000005 : Boolean;
TotalPositiveQty@1000000007 : Decimal;
TotalNegativeQty@1000000008 : Decimal;
totalQty@1000000009 : Decimal;
DocumentNo@1000000010 : Code[20];
NegativeValue@1000000011 : Boolean;
PositiveValue@1000000012 : Boolean;
Unitcost@1000000014 : Decimal;
"Value Entry"
@1000000015 : Record 5802;
Barcode@1000000013 : Code[20];
ItemLedger@1000000016 : Record 32;
ItemBarcode@1000000017 : Code[20];
window@1000000018 : Dialog;
timProgress@1000000019 : Time;
intProgress@1000000020 : Integer;
LineCount@1000000021 : BigInteger;
NoOfRecords@1000000022 : BigInteger;
ExcelBuf@1000000023 : TEMPORARY Record 370;
Text001@1000000038 : TextConst 'ENU=Negative/Positive';
Text002@1000000037 : TextConst 'ENU=Barcode';
Text003@1000000036 : TextConst 'ENU=Warehouse';
Text004@1000000035 : TextConst 'ENU=Cost';
Text005@1000000034 : TextConst 'ENU=Available';
Text006@1000000033 : TextConst 'ENU=Import';
Text007@1000000032 : TextConst 'ENU="Date "';
Text008@1000000031 : TextConst 'ENU=Order No';
Text009@1000000030 : TextConst 'ENU="Total "';
Text010@1000000029 : TextConst 'ENU=Company Name';
Text011@1000000028 : TextConst 'ENU=User ID';
Text012@1000000027 : TextConst 'ENU=Report No.';
Text013@1000000026 : TextConst 'ENU=Date';
Text014@1000000025 : TextConst 'ENU=Adjustments';
Text015@1000000024 : TextConst 'ENU=Report Name';
Text016@1000000039 : TextConst 'ENU=Pos.';
Text017@1000000040 : TextConst 'ENU=Neg.';
NextBarcode@1000000041 : Code[20];
CurrentBarcode@1000000042 : Code[20];
NextLocationCode@1000000043 : Code[20];
CurrentLocationCode@1000000044 : Code[20];
PositiveItemLedger@1000000045 : Record 32;
NegativeItemLedger@1000000046 : Record 32;
Number@1000000047 : Integer;
PreviousBarcode@1000000048 : Code[20];
PreviousLocationCode@1000000049 : Code[20];
FirstBarcode@1000000050 : Code[20];
FirstLocationCode@1000000051 : Code[20];
FooterCount@1000000006 : Integer;
PROCEDURE MakeExcelInfo@1000000000();
BEGIN
ExcelBuf.SetUseInfoSheed;
ExcelBuf.AddInfoColumn(FORMAT(Text010),FALSE,'',TRUE,FALSE,FALSE,'');
ExcelBuf.AddInfoColumn(COMPANYNAME,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text015),FALSE,'',TRUE,FALSE,FALSE,'');
ExcelBuf.AddInfoColumn(FORMAT(Text014),FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text012),FALSE,'',TRUE,FALSE,FALSE,'');
ExcelBuf.AddInfoColumn(REPORT::Adjustments,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text011),FALSE,'',TRUE,FALSE,FALSE,'');
ExcelBuf.AddInfoColumn(USERID,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.NewRow;
ExcelBuf.AddInfoColumn(FORMAT(Text013),FALSE,'',TRUE,FALSE,FALSE,'');
ExcelBuf.AddInfoColumn(TODAY,FALSE,'',FALSE,FALSE,FALSE,'');
//ExcelBuf.NewRow;
//ExcelBuf.AddInfoColumn(FORMAT(Text014),FALSE,'',TRUE,FALSE,FALSE,'');
//ExcelBuf.AddInfoColumn(Item.GETFILTERS,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.ClearNewRow;
MakeExcelDataHeader;
END;
PROCEDURE MakeExcelDataHeader@1000000001();
BEGIN
ExcelBuf.NewRow;
ExcelBuf.AddColumn('',FALSE,'',TRUE,FALSE,TRUE,'@');
ExcelBuf.AddColumn(FORMAT( Text001),FALSE,'',TRUE,FALSE,TRUE,'@');
ExcelBuf.AddColumn(FORMAT(Text002),FALSE,'',TRUE,FALSE,TRUE,'@');
ExcelBuf.AddColumn(FORMAT(Text003),FALSE,'',TRUE,FALSE,TRUE,'@');
ExcelBuf.AddColumn(FORMAT(Text004),FALSE,'',TRUE,FALSE,TRUE,'@');
END;
PROCEDURE MakeExcelDataBody@1000000002();
BEGIN
ExcelBuf.NewRow;
ExcelBuf.AddColumn(Text016,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.AddColumn(TotalPositiveQty,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.AddColumn("Item Ledger Entry"."Item No.",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.AddColumn("Item Ledger Entry"."Location Code",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.AddColumn(Unitcost,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.NewRow;
ExcelBuf.AddColumn(Text017,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.AddColumn(TotalNegativeQty,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.AddColumn("Item Ledger Entry"."Item No.",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.AddColumn("Item Ledger Entry"."Location Code",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuf.AddColumn(Unitcost,FALSE,'',FALSE,FALSE,FALSE,'');
//ExcelBuf.AddColumn(FinalQty,FALSE,'',FALSE,FALSE,FALSE,'');
//ExcelBuf.AddColumn(FinalReserved,FALSE,'',FALSE,FALSE,FALSE,'');
//ExcelBuf.AddColumn(FinalAvailable,FALSE,'',FALSE,FALSE,FALSE,'');
END;
PROCEDURE CreateExcelbook@1000000003();
BEGIN
ExcelBuf.CreateBook;
ExcelBuf.CreateSheet(Text010,Text011,COMPANYNAME,USERID);
ExcelBuf.GiveUserControl;
ERROR('');
END;
BEGIN
END.
}
RDLDATA
{
}
}
Comments
It appears your exporting to Excel?
Is that the slow part?
http://www.BiloBeauty.com
http://www.autismspeaks.org
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Which will be sitting on the Buffer for the second time...
Regards,
Raveendran.BS
this is the most probable reason :thumbsup:
Just a happy frood who knows where his towel is
so, when it is check marked then excell will be load. otherwise not.
i remove this excell export and it is faster.
but i need also excell export.
what is the solution?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
|To-Increase|