Increment no.series in reports

Hey,

I want to insert in a report a number series.I have a textbox in my report which contains a number  and i want for each run report a unic number.

Example First run number:0001

              Second run:0002.

Has anyone an idea?

  • Create a new field in No. series table TEMPNO and on No. series lines add the starting date and Starting Nos. and Last no. used, For example Starting No. 0001 and Last no. used 0001, now in your report

    Variable
    Noseries Record No. series Line
    NewNo Code 10

    Put this code in OnAfterGetRecord of the data item

    Noseries.reset;
    Noseries.setrange(code,'TEMPNO');
    IF Noseries.find('-') then begin
    Newno := incrstr(noseries."last no. used");
    Noseries."last no. used" := Newno;
    noseries.modify;
    end;
  • In reply to sbhatbng:

    Hi sbhatbng,
    This is my code:

    Noseries.RESET;
    Noseries.SETRANGE(Noseries."Series Code",'BONUS-VORA');
    IF Noseries.FIND('-') THEN begin
    NewNo :=INCSTR(Noseries."Last No. Used");
    Noseries."Last No. Used" := NewNo;
    MESSAGE('%1',Noseries."Last No. Used");
    Noseries.MODIFY;
    CurrReport.BREAK
    END;
    When i run the reports in the message MESSAGE('%1',Noseries."Last No. Used"); is the good value but in text field i have no value :(
  • In reply to IuliaCIC:

    Hi,
    Are you displaying newno in your report then it should be work. check your both fields in message.
    and check your fields visibility too. Because code you written is correct.
  • In reply to IuliaCIC:

    Your message should come after Noseries.modify and you will see that the it will display the new no. series value.
  • The problem was on the indentation of DatItem.
    Thanks for the help!
Related