How can I print a number on a report once it is printed?

demi222demi222 Member Posts: 131
Every time certain reports are printed (such as report 206, 207, 208, etc), they should get a number...

For example:
I have added a new row to No. Series Table 308
code = D
Description = DNumbering
Default Nos. = checked

Then I added a new row to No. Series Line Table 309
Series Code = D
Line No. = 10000
Starting No. = 1
Ending No. = 999999
Increment-by No. = 1

Can someone get me started as to how I can get the reports to print the number only if they are printed? It must be last No. used +1.. I want the report to have the current No.

I added a text box to one of the reports, but I don't know how to do this...

please help me.


  • Options
    ArhontisArhontis Member Posts: 667

    If you want to get a number only on print (not preview), then you can use the property PREVIEW of CurrReport. Define a code var and:
      varReportNo := NoSeriesMgt.GetNextNo('D',0D,TRUE);
    and put the SourceExpr of your textbox to your varReportNo.
    The NoSeriesMgt is var of codeunit: NoSeriesManagement

    That might do it... :whistle:
  • Options
    demi222demi222 Member Posts: 131
    Do I put this code on the PreSection of my report?

    How will it know which number series to get the numbers from?

    what is the ('D',0D,TRUE) do?

    ... please help
  • Options
    ArhontisArhontis Member Posts: 667

    The number series is the 'D' parameter... and will increase the no series line by the increment field you have specified in the No. Series

    The 0D parameter is used to filter the no series and display some errors and modify the no. series last date modified.

    The last parameter enables the modification of the no. series line.

    Code like that is often used in Navision. You will learn in time to use it yourself. :)

    For more info take a look at the function GetNextNo in the codeunit 396:NoSeriesManagement. :whistle:
  • Options
    demi222demi222 Member Posts: 131
    so the values that I put in the No. Series Table and the No. Series Line table, are not the ones used?

    I'm sorry, I am trying to understand... I have looked at the codeunit NoSeriesManagement.

    Are you telling me, that if I put the code you gave me on the presection of my report that it will get the Numbers I want.

    sorry again... completely lost :(
  • Options
    ArhontisArhontis Member Posts: 667
    The function (GetNextNo) in the code will try to find the no. series 'D', then increase the Last No Used and give you the next proper number to the varReportNo. If you place the code in the OnPreReport, declare the global variables, and place a textbox on your header with SourceExpr=varReportNo , then it should work. The code also checks the if you are in preview mode, so that you get a new number only if you actually print the report.
  • Options
    demi222demi222 Member Posts: 131
    you are unbelievable!

    thank you!

    I understand now. :D
Sign In or Register to comment.