Numbering by pressing F3

tiagofrancistiagofrancis Member Posts: 48
Hi Folks,

I've built a form based on a table of my one.
Generaly, when i feed the table with some process i look for the last entry number and +=1.

But, when i hit F3 on the form the record does not increment..
What is the best easy way to handle this...?

Thanks in advance..

Comments

  • SavatageSavatage Member Posts: 7,142
    search the forum about setting up your own number series.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Actually in this case I don't think you need a number series. Either

    a/ use a primary key of type BigInteger with the property Autoincrement set (see table 405 for an example) OR

    b/you need to find the last record and use code to increment it. (see table 32 for an example)

    Note that in a/ above the numbers may not be sequential and some numbers may be skipped. So if you need a contiguous series then use B/
    David Singleton
  • arindomarindom Member Posts: 52
    You have to write code on insert of table .and call No. series managment codeunit. see any master table oninsert .
  • nunomaianunomaia Member Posts: 1,153
    Actually in this case I don't think you need a number series. Either

    a/ use a primary key of type BigInteger with the property Autoincrement set (see table 405 for an example) OR

    b/you need to find the last record and use code to increment it. (see table 32 for an example)

    Note that in a/ above the numbers may not be sequential and some numbers may be skipped. So if you need a contiguous series then use B/

    If are using option b given by david then you could use this std code.
      IF JobLedgEntry."Entry No." = 0 THEN BEGIN
        JobLedgEntry.LOCKTABLE;
        IF JobLedgEntry.FIND('+') THEN
          NextEntryNo := JobLedgEntry."Entry No.";
        NextEntryNo := NextEntryNo + 1;
      END;
    
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • tiagofrancistiagofrancis Member Posts: 48
    In what trigger do i have to put the code?
  • nunomaianunomaia Member Posts: 1,153
    I miss understood your question. I thought that you wanted to auto increment using a codeunit. You will increment in insert the easiest way will be increment using auto increment property.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • najlamthnajlamth Member Posts: 18
    Hi,,,,
    donot forget to set property "NotBlank" to false.
    If your data type is integer for this field you should to write code to increment tthis field like below:

    YourTable.RESET;
    YourTable.SETFILTER("No.","No.");
    IF YourTable.FIND('+') THEN
    "No. Series":= YourTable."No. Series" + 1
    ELSE
    "No. Series":=1;

    Note: there is autoincrement property in NAVISION for the integer fields :(
    Master Navision Developer
  • najlamthnajlamth Member Posts: 18
    Hi,,,,
    donot forget to set property "NotBlank" to false.
    If your data type is integer for this field you should to write code to increment tthis field like below:

    YourTable.RESET;
    YourTable.SETFILTER("No.","No.");
    IF YourTable.FIND('+') THEN
    "No. Series":= YourTable."No. Series" + 1
    ELSE
    "No. Series":=1;

    Note: there is autoincrement property in NAVISION for the integer fields :(
    Master Navision Developer
Sign In or Register to comment.