Line No - NAV 2017 New Table

Hi all,

Please, I need your help!

I am creating a new table and I want to set up “Line No” field.

What I did was:

I. The first way:

  1. Table → Field " Line No" → Field Properties → Auto Increment (Yes)

  2. In the Page → Subform → Properties → AutoSplitKey (Yes)

After this when i run the page [Header and Lines (Subform page)] , field Line No does not auto increment by 10000 automatically.

II.The second way:

  1. In tables lines → C/AL → On Insert trigger → the code below:
LineNo := 0;
IF ContainerLines.FINDFIRST THEN BEGIN 
  LineNo := LineNo + 10000;
  ContainerLines."Line No" := LineNo;
END;

But also in this way , I don’t get the desired result.

Please can you help me how can I set up Line No, with auto increment no by 10000, 20000 ect… ?

Thank you for your support :slight_smile:

Hello there,

Line No must be in PK

you don’t need auto increment property to be set for line no. and any code.

if your line no. is part of primary key at the end and autosplitkey property will take care of it.

please check sales line (37) table for reference.

Hi,

I suggest Mohana method. I would wor Fine for you.