How to write auto increment code with or without NoseriesManagement

i have taken a field cust id with data type integer and i want that every time whenever a new entry is done cust id is incremented by 10.

i want the code that is written with the help NoseriesManagement (code unit 396)

as well as the code i.e written without code unit 396.

can anyone help me please…

The number series management always does an increase of one. You cannot increase automatically by 10 with the standard code, as you have found out.

INCSTR is the function normally used to increase a string value with one. So if you want to do it in the same way, and with less possible changes, then you need to call INCSTR 10 times, instead of just one.

[:D]Hi Bittu,
Really Interesting Question / Requirement As Usually You Got Cu 396 Standard .
If you really want to implement that code then Lets See The Situations

  1. Sort the Record By Find Last Get last Rec No then Add 10 comprises new No.

Testtable.RESET;
Testtable.SETCURRENTKEY(“No.”);
IF Testtable.FINDLAST THEN Begin
MESSAGE(’%1’,Testtable.“No.”);
“Next No.” := Testtable.“No.” + 10;

Exit(“Next No.”);
End;

Note: As You said It’s a Integer , So above Code works (Hope So…:)[;)])

  1. If the No is Code Datatype You Have To compare All No’s For the Latest As 1000 < 9
    (OR)
    Use a table To Store Last No’s for Respective Tables As 308, 309

If No Is Code datatype As we Mostly Use (Standard Way)

Then As Erik Said you have to use INCSTR. but real part is we have to find the Last Record First I know the pain B’Coz

I Did a WorkAround(Codeunit) in Which i Searched For Last Big No…i.e Like 100 >9

But When You Try to Get Last rec Ex: IF Table.Findlast then Then You will Get 9 BCoz According TO CAL 9>100 in Text/CODE

So you have To Compare Each Record Until You Get Highest.

j := 0;
Rec.RESET;

IF Rec.ASCENDING(TRUE) THEN
IF Rec.FINDSET THEN
REPEAT

NoG := Rec.“No.”; //NoG Code Datatype
EVALUATE(Num,NoG); //Num Integer
IF Num > j THEN BEGIN
j:= Num;

END;
UNTIL Rec.NEXT = 0;

// Here you can Add 10 To j .ie J := j+10;

NoG := FORMAT(j);

Done …[:D] It Worked For Me . [;)]

Hey Bittu,

I never used but I believe this is something which may help you. In the No Series Management there’s a column as Increment by Look at the below screenshot and update it with 10 and then try please.