Quantcast
Channel: Microsoft Dynamics NAV Forum - Recent Threads
Viewing all articles
Browse latest Browse all 29197

RE: multiple call to report.SAVEASHTML causes renaming record

$
0
0

Hi

This is what it looks like. Two methods in a form. RunLine woeks fine, but when calling it from RunAll I am asked if I want to rename the record(Rec). Further below see also a txt-fob (dont know how to attach) for the whole test scenario.

*******RunAll()*****************************************************************

IF FINDFIRST THEN REPEAT

 RunLine;

UNTIL NEXT = 0;

*******RunLine()***************************************************************

l_rec := Rec;

l_rec.SETRECFILTER;

l_report.SETTABLEVIEW(l_rec);

l_report.SAVEASHTML('c:\testfolder\test' + FORMAT(Code) + '.HTM');

*********************************************************************************

*********************************************************************************

**************************THE FOB ********************************************

DO LIKE THIS:

Edit the file path found in code in the form.

Take a quich look at the minimal code.

Run the form.

Press "Fill Table" to get test data.

Press "Run Line" to see that it works fine.

Press "Run All" and you will be asked whether you want to rename the record.

*********************************************************************************

*********************************************************************************

OBJECT Table 66666 TestTable

{

 OBJECT-PROPERTIES

 {

   Date=13-04-25;

   Time=11:16:32;

   Modified=Yes;

   Version List=;

 }

 PROPERTIES

 {

 }

 FIELDS

 {

   { 1   ;   ;Code                ;Integer        }

   { 2   ;   ;Description         ;Text30         }

 }

 KEYS

 {

   {    ;Code                                    ;Clustered=Yes }

 }

 FIELDGROUPS

 {

 }

 CODE

 {

   PROCEDURE FillTable@1000000000();

   BEGIN

     DELETEALL;

     Code := 1;

     Description := 'Dummytext';

     INSERT;

     Code := 2;

     INSERT;

     Code := 3;

     INSERT;

   END;

   BEGIN

   END.

 }

}

OBJECT Form 66666 TestForm

{

 OBJECT-PROPERTIES

 {

   Date=13-04-25;

   Time=11:20:48;

   Modified=Yes;

   Version List=;

 }

 PROPERTIES

 {

   Width=9790;

   Height=6710;

   TableBoxID=1000000000;

   SourceTable=Table66666;

 }

 CONTROLS

 {

   { 1000000000;TableBox;220 ;220  ;9350 ;5500 ;HorzGlue=Both;

                                                VertGlue=Both }

   { 1000000001;TextBox;0    ;0    ;1700 ;0    ;ParentControl=1000000000;

                                                InColumn=Yes;

                                                SourceExpr=Code }

   { 1000000002;Label  ;0    ;0    ;0    ;0    ;ParentControl=1000000001;

                                                InColumnHeading=Yes }

   { 1000000003;TextBox;0    ;0    ;4400 ;0    ;HorzGlue=Both;

                                                ParentControl=1000000000;

                                                InColumn=Yes;

                                                SourceExpr=Description }

   { 1000000004;Label  ;0    ;0    ;0    ;0    ;ParentControl=1000000003;

                                                InColumnHeading=Yes }

   { 1000000005;CommandButton;2530;5940;2200;550;

                                                CaptionML=SVE=Fill Table;

                                                OnPush=BEGIN

                                                         FillTable;

                                                       END;

                                                        }

   { 1000000006;CommandButton;4950;5940;2200;550;

                                                CaptionML=SVE=Run Line;

                                                OnPush=BEGIN

                                                         RunLine;

                                                       END;

                                                        }

   { 1000000007;CommandButton;7370;5940;2200;550;

                                                CaptionML=SVE=Run All;

                                                OnPush=BEGIN

                                                         RunAll;

                                                       END;

                                                        }

 }

 CODE

 {

   PROCEDURE RunAll@1000000002();

   BEGIN

     IF FINDFIRST THEN REPEAT

       RunLine;

     UNTIL NEXT = 0;

   END;

   PROCEDURE RunLine@1000000003();

   VAR

     l_report@1000000000 : Report 66666;

     l_rec@1000000001 : Record 66666;

   BEGIN

     //CONFIRMS ARE ONLY TO MAKE IT POSSIBLE TO BREAK PROCESS

     l_rec := Rec;

     l_rec.SETRECFILTER;

     l_report.SETTABLEVIEW(l_rec);

     IF NOT CONFIRM('Before',TRUE) THEN ERROR('');

     l_report.SAVEASHTML('c:\qqq\test' + FORMAT(Code) + '.HTM');

     IF NOT CONFIRM('After',TRUE) THEN ERROR('');

   END;

   BEGIN

   END.

 }

}

OBJECT Report 66666 TestReport

{

 OBJECT-PROPERTIES

 {

   Date=13-04-24;

   Time=21:40:42;

   Modified=Yes;

   Version List=;

 }

 PROPERTIES

 {

 }

 DATAITEMS

 {

   { PROPERTIES

     {

       DataItemTable=Table66666;

       DataItemTableView=SORTING(Code);

       ReqFilterFields=Code;

     }

     SECTIONS

     {

       { PROPERTIES

         {

           SectionType=Header;

           PrintOnEveryPage=Yes;

           SectionWidth=18150;

           SectionHeight=1692;

         }

         CONTROLS

         {

           { 1000000001;Label  ;0    ;0    ;7500 ;423  ;FontSize=8;

                                                        FontBold=Yes;

                                                        CaptionML=SVE=TestTabell }

           { 1000000002;TextBox;15000;0    ;3150 ;423  ;HorzAlign=Right;

                                                        SourceExpr=FORMAT(TODAY,0,4) }

           { 1000000003;TextBox;0    ;423  ;7500 ;423  ;SourceExpr=COMPANYNAME }

           { 1000000004;TextBox;17700;423  ;450  ;423  ;CaptionML=SVE=Sida;

                                                        SourceExpr=CurrReport.PAGENO }

           { 1000000005;Label  ;16950;423  ;750  ;423  ;ParentControl=1000000004 }

           { 1000000006;TextBox;15900;846  ;2250 ;423  ;HorzAlign=Right;

                                                        SourceExpr=USERID }

         }

          }

       { PROPERTIES

         {

           SectionType=Body;

           SectionWidth=18150;

           SectionHeight=1269;

         }

         CONTROLS

         {

           { 1000000008;TextBox;3150 ;0    ;1050 ;423  ;HorzAlign=Left;

                                                        SourceExpr=Code }

           { 1000000009;Label  ;0    ;0    ;3000 ;423  ;ParentControl=1000000008 }

           { 1000000011;TextBox;3150 ;423  ;4500 ;423  ;HorzAlign=Left;

                                                        SourceExpr=Description }

           { 1000000012;Label  ;0    ;423  ;3000 ;423  ;ParentControl=1000000011 }

         }

          }

     }

      }

 }

 REQUESTFORM

 {

   PROPERTIES

   {

     Width=9020;

     Height=3410;

   }

   CONTROLS

   {

   }

 }

 REQUESTPAGE

 {

   PROPERTIES

   {

   }

   CONTROLS

   {

   }

 }

 CODE

 {

   BEGIN

   END.

 }

 RDLDATA

 {

 }

}


Viewing all articles
Browse latest Browse all 29197

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>