print multiple copies of report [solved]

ReinhardReinhard Member Posts: 249
Hi...
I know that I can use a pageLoop of type Integer dataitem to control number of copies, but that is not possible if I am running the report like this:
REPORT.RUNMODAL(10077,TRUE,TRUE,Rec);

there is no way I can pass in an Integer record...

the number of copies to print is stored in a table; it is not entered by the user

Comments

  • garakgarak Member Posts: 3,263
    and why you not get the "No of copies" from the table and set with it the value the variable ?
    Do you make it right, it works too!
  • ReinhardReinhard Member Posts: 249
    can you show an example?
  • kapamaroukapamarou Member Posts: 1,152
    If you don't mind declaring a variable for the report and running it , you can use a function to pass an integer as a parameter. Do you need to run the report like this?
    REPORT.RUNMODAL(10077,TRUE,TRUE,Rec);
  • ReinhardReinhard Member Posts: 249
    I see... yes it can be changed thanks guys.
  • navuser1navuser1 Member Posts: 1,329
    Try this code.............

    Windows.OPEN(TXT);
    Windows.INPUT(1,Count);
    FOR I :=0 TO (Count-1) DO BEGIN
    REPORT.RUNMODAL(10077,TRUE,TRUE,Rec);
    END;
    Windows.CLOSE



    '''''''''''''''''''''''''''''''''''''''''
    TXT =No. Of Copys #1####
    I = Integer Variable
    Count = Integer Variable
    ''''''''''''''''''''''''''''''''''''''''''
    Now or Never
  • kapamaroukapamarou Member Posts: 1,152
    navuser1 wrote:
    Try this code.............
    Windows.OPEN(TXT);
    Windows.INPUT(1,Count);
    FOR I :=0 TO (Count-1) DO BEGIN
    REPORT.RUNMODAL(10077,TRUE,TRUE,Rec);
    END;
    Windows.CLOSE

    '''''''''''''''''''''''''''''''''''''''''
    TXT =No. Of Copys #1####
    I = Integer Variable
    Count = Integer Variable
    ''''''''''''''''''''''''''''''''''''''''''

    There is a catch to this though. This way, you are actually running the report many times. Maybe you need to run only the copy loop many times. Imagine that the report modifies a Header field that is filtered. In the second execution the record will be filtered out...

    You could do this as long as you know that you won't face any such issues...
  • navuser1navuser1 Member Posts: 1,329
    Hi All,

    There is an another solution..
    OBJECT Report 91501 Customer detail
    {
      OBJECT-PROPERTIES
      {
        Date=25-09-08;
        Time=[ 5:42:07 PM];
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table2000000026;
            DataItemTableView=SORTING(Number);
            NewPagePerRecord=Yes;
            OnPreDataItem=BEGIN
                            SETRANGE(Integer.Number,1,NoOfCopies);
                          END;
    
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=19950;
                SectionHeight=0;
              }
              CONTROLS
              {
              }
               }
          }
           }
        { PROPERTIES
          {
            DataItemIndent=1;
            DataItemTable=Table18;
            PrintOnlyIfDetail=Yes;
            OnPreDataItem=BEGIN
                            CurrReport.CREATETOTALS("Cust. Ledger Entry".Amount);
                          END;
    
            ReqFilterFields=Date Filter;
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Footer;
                SectionWidth=19950;
                SectionHeight=846;
              }
              CONTROLS
              {
                { 1000000022;TextBox;5400 ;423  ;8100 ;423  ;FontSize=16;
                                                             SourceExpr="Cust. Ledger Entry".Amount }
                { 1000000023;Label  ;900  ;423  ;4050 ;423  ;FontSize=16;
                                                             CaptionML=ENU=Grand total is: }
              }
               }
          }
           }
        { PROPERTIES
          {
            DataItemIndent=2;
            DataItemTable=Table21;
            DataItemTableView=SORTING(Customer No.,Posting Date);
            ReqFilterFields=Posting Date;
            TotalFields=Amount;
            GroupTotalFields=Posting Date;
            DataItemLink=Customer No.=FIELD(No.),
                         Posting Date=FIELD(Date Filter);
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Header;
                SectionWidth=19950;
                SectionHeight=1269;
              }
              CONTROLS
              {
                { 1000000016;TextBox;0    ;846  ;1500 ;423  ;HorzAlign=Right;
                                                             SourceExpr=Customer."No." }
                { 1000000017;Label  ;0    ;0    ;1500 ;846  ;ParentControl=1000000016;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000018;TextBox;1650 ;846  ;4500 ;423  ;HorzAlign=Right;
                                                             SourceExpr=Customer.Name }
                { 1000000019;Label  ;1650 ;0    ;4500 ;846  ;ParentControl=1000000018;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000020;TextBox;6300 ;846  ;4500 ;423  ;HorzAlign=Right;
                                                             SourceExpr=Customer.City }
                { 1000000021;Label  ;6300 ;0    ;4500 ;846  ;ParentControl=1000000020;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
              }
               }
            { PROPERTIES
              {
                SectionType=Header;
                PrintOnEveryPage=No;
                SectionWidth=19950;
                SectionHeight=846;
              }
              CONTROLS
              {
                { 1000000001;Label  ;1350 ;0    ;1500 ;846  ;ParentControl=1000000000;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000007;Label  ;5400 ;0    ;1500 ;846  ;ParentControl=1000000006;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000009;Label  ;7050 ;0    ;4500 ;846  ;ParentControl=1000000008;
                                                             HorzAlign=Left;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000011;Label  ;11700;0    ;1800 ;846  ;ParentControl=1000000010;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000005;Label  ;3000 ;0    ;2250 ;846  ;ParentControl=1000000004;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000003;Label  ;0    ;0    ;1200 ;846  ;ParentControl=1000000002;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
              }
               }
            { PROPERTIES
              {
                SectionType=GroupHeader;
                SectionWidth=19950;
                SectionHeight=423;
              }
              CONTROLS
              {
                { 1000000002;TextBox;0    ;0    ;1200 ;423  ;SourceExpr="Posting Date" }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=19950;
                SectionHeight=423;
                OnPreSection=BEGIN
                                                         CurrReport.SHOWOUTPUT(ShowDetails);
                             END;
    
              }
              CONTROLS
              {
                { 1000000000;TextBox;1350 ;0    ;1500 ;423  ;SourceExpr="Customer No." }
                { 1000000004;TextBox;3000 ;0    ;2250 ;423  ;HorzAlign=Right;
                                                             SourceExpr="Document Type" }
                { 1000000006;TextBox;5400 ;0    ;1500 ;423  ;HorzAlign=Center;
                                                             SourceExpr="Document No." }
                { 1000000008;TextBox;7050 ;0    ;4500 ;423  ;HorzAlign=Left;
                                                             SourceExpr=Description }
                { 1000000010;TextBox;11700;0    ;1800 ;423  ;SourceExpr=Amount }
              }
               }
            { PROPERTIES
              {
                SectionType=GroupFooter;
                SectionWidth=19950;
                SectionHeight=846;
              }
              CONTROLS
              {
                { 1000000012;TextBox;10500;423  ;3000 ;423  ;FontSize=12;
                                                             SourceExpr=Amount }
                { 1000000013;Shape  ;11100;0    ;2400 ;423  ;ShapeStyle=HorzLine }
              }
               }
            { PROPERTIES
              {
                SectionType=Footer;
                SectionWidth=19950;
                SectionHeight=846;
              }
              CONTROLS
              {
                { 1000000015;TextBox;10050;423  ;3450 ;423  ;FontSize=15;
                                                             SourceExpr=Amount }
                { 1000000014;Label  ;6750 ;423  ;2400 ;423  ;FontSize=15;
                                                             CaptionML=ENU=Total is: }
              }
               }
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=9020;
          Height=3410;
          SaveValues=Yes;
        }
        CONTROLS
        {
          { 1000000000;CheckBox;4510;550  ;440  ;440  ;ShowCaption=No;
                                                       CaptionML=ENU=ShowDetails;
                                                       SourceExpr=ShowDetails }
          { 1000000001;Label  ;770  ;550  ;3300 ;440  ;ParentControl=1000000000 }
          { 1000000002;TextBox;4180 ;1100 ;1700 ;440  ;SourceExpr=NoOfCopies }
          { 1000000003;Label  ;770  ;1100 ;3300 ;440  ;ParentControl=1000000002 }
        }
      }
      CODE
      {
        VAR
          ShowDetails@1000000000 : Boolean;
          NoOfCopies@1000000001 : Integer;
    
        BEGIN
        END.
      }
    }
    

    [Added code & /code tags by Administrator]
    Now or Never
Sign In or Register to comment.