Increase Page Number In a Report

vipinkuruvillavipinkuruvilla Member Posts: 143
Hai All,

I have two fields Serial Start No and Serial End No in my request form. My Data Item is Sales Line. I have Sales Line Header and Sales Line Body sections in my report. I have a field SLNo in my body section.

Now consider the following :

Serial Start No = 1
Serail End No = 10

Now I want both my header and body section to print 10 pages (depending on request form values) . And also SLNo field should be 1 in my first page and it should get incremented as per my pages.

Now if the Serial Start No = 2 and Serial End No = 10 then the report should have 9 pages. But here the SLNo will start from 2 and end at 10.

Can anyone tell me how I can achieve this. Any help would be really appreciated.

Thanks in advance.

Answers

  • BeliasBelias Member Posts: 2,998
    put serial no. start in the header, print on every page and (if you are sure that the "no of pages" = "serial no. end" - "serila no. start" +1) auto increment the serial no. start every time you show the header.
    Put appropriate filters in order to filter from 2 to 10 and you're done.
    But maybe your report is not so simple
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • dayakardayakar Member Posts: 68
    edited 2009-03-26
    Do you need to Print report ("Sales End No." - "Sales Start No." + 1) times ?

    Take Integer DataItem to show your fields...

    1. Use the request form to input the "Serial Start No." and "Serial End No."
    2. Take a Temperary SalesLine record variable and inert in the Onaftergetrecord
    SalesLine-OnafterGetRecord()
           //Insert in to TempRecord.  
           TempSalesLine.Init;
           TempSalesLine := SalesLine;
           TempSalesLine.insert;
    

    3. Use the Integer DataItem and Its sections to show the fields from the TempSalesline Rec.
    4. To loop the Iteger DataItem use ("Serial End No." - "Serial Start No." + 1) value.
    5. Instead of using CurrReport.PageNo take a seperate variable and increment it for each newpage.
  • BeliasBelias Member Posts: 2,998
    Just found a better solution using pageno:

    textbox in header, sourceexpr = currreport.pageno(currreport.pageno + startNo - 1)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • dayakardayakar Member Posts: 68
    Just found a better solution using pageno:

    textbox in header, sourceexpr = currreport.pageno(currreport.pageno + startNo - 1)

    currreport.pageno(Expr);

    Its simple and better.
    Thanks for the idea Belias :wink: .
  • vipinkuruvillavipinkuruvilla Member Posts: 143
    Belias wrote:
    Just found a better solution using pageno:

    textbox in header, sourceexpr = currreport.pageno(currreport.pageno + startNo - 1)

    But how Can I print my body section,the times the value of the EndNo?
  • dayakardayakar Member Posts: 68
    Which DataItem - Section you are using to print?
  • BeliasBelias Member Posts: 2,998
    I think I have not understood what you want to achieve...
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • vipinkuruvillavipinkuruvilla Member Posts: 143
    dayakar wrote:
    Which DataItem - Section you are using to print?

    DataItem is Sales Line

    Section is Body....

    Yes the Header Section have the property like "Print on Every Page".But I want my Body section to be printed like say ,depending on the StartNo and EndNo.
  • vipinkuruvillavipinkuruvilla Member Posts: 143
    Belias wrote:
    I think I have not understood what you want to achieve...

    I have a header section and body section in my report. Depending on the StartNo and EndNo values I want both my header and body section to be printed.
    The Header Section have the property like "Print on Every Page".But I want my Body section to be printed like say ,depending on the StartNo and EndNo.

    Kindly help....
  • dayakardayakar Member Posts: 68
    To loop your body section N number of times you have to loop the dataitem N times.

    As i mentioned earlier, Use the Tamp. record Variable to store in the Sales lines data, loop the Integer DateItem N times and show your fields in the Integer dataitem sections.

    For reference how to use temp record and integer dataitem, go through the report 120 and have a look at Currncy loop.
  • vipinkuruvillavipinkuruvilla Member Posts: 143
    dayakar wrote:
    To loop your body section N number of times you have to loop the dataitem N times.

    As i mentioned earlier, Use the Tamp. record Variable to store in the Sales lines data, loop the Integer DateItem N times and show your fields in the Integer dataitem sections.

    For reference how to use temp record and integer dataitem, go through the report 120 and have a look at Currncy loop.


    I did that according to what u said. But my first page is printing blank rest are coming right......Dont know what is wrong......Can u please help me with this...

    The following is my code,which i have written for looping:
    Integer - OnPreDataItem()
    -------------------------
    IF (StartNo <= EndNo) THEN
    BEGIN
    u := (EndNo - StartNo) + 1;
    Integer.SETRANGE(Number,StartNo,u);
    END;
    
    

    I have also written the following code:
    Integer - Body onPostSection()
    ------------------------------
    IF Number MOD 1 = 0 THEN
    CurrReport.NEWPAGE;
    
    

    Kindly help me in finding my mistake........

    Thanx in advance.....
  • BeliasBelias Member Posts: 2,998
    Integer - Body onPostSection()
    IF Number MOD 1 = 0 THEN
    CurrReport.NEWPAGE;

    Thing (I point out that I have not already undertood the whole thing) :oops:
    Condition "Number MOD 1 = 0" will always be true...
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • dayakardayakar Member Posts: 68
    Integer - OnAfterGetREcord()
    -------------------------
    IF Number = 1 Then
      TempSaleslineRec.Findfirst
    Else
      TempSaleslineRec.Next;
    


    Have u missed this :-k
    I have also written the following code:


    Code: Select all

    Integer - Body onPostSection()
    IF Number MOD 1 = 0 THEN
    CurrReport.NEWPAGE;

    Remove this code its not needed.
  • vipinkuruvillavipinkuruvilla Member Posts: 143
    Hai All,

    I didnt have a clue to achieve this first until I got the idea to use Integer from here. Thanx a lot guys :D .

    This is what I did :
    Integer OnPreDataItem()
    ------------------------
    
    u := (SerialEndNo - SerialStartNo) + 1;
    IF (SerialStartNo <= SerialEndNo) THEN
    BEGIN
    Integer.SETRANGE(Number,1,u);
    END;
    
    where u is just an integer variable.
    
    Integer - onAfterGetRecord()
    ----------------------------
    
    
    IF (SerialStartNo <= SerialEndNo) THEN
    BEGIN
    SlNo := SerialStartNo;
    END;
    SerialStartNo += 1;
    
    
    This is done so that the field SL No will have the values starting from SerialStartNo till SerialEndNo. Both SerialStartNo and SerialEndNo are integer fields given in my request form.
    
    Now whatever you are going to put in the Integer Body Section are going to get popolated according to the values given for SerialStartNo and SerialEndNo.
    
    Integer - Body onPostSection()
    -------------------------------
    
    
    IF Number MOD 1 = 0 THEN
    CurrReport.NEWPAGE;
    
    Since I have only one item at a time coming I have put this code. Those need more than one item may increase 1. This code will go to new page after 1 record.
    

    Thanx a lot for helping me out guys.............
  • dayakardayakar Member Posts: 68
    You did it :whistle:
  • vipinkuruvillavipinkuruvilla Member Posts: 143
    dayakar wrote:
    You did it :whistle:

    Yup...Thanx a lot dude :?
Sign In or Register to comment.