Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Start Integer field from 1000 ???

Posted on by Microsoft Employee

hi all,

i have a primary key field with type of integer and autoincrement = true, i want when i insert the record the primary key field start from 1000.

*This post is locked for comments

  • KTA Profile Picture
    KTA 1,200 on at
    RE: Start Integer field from 1000 ???

    [quote user="Tanveer Ahmad"]

    @KTA

    actually the main problem is  assign 10000 to primary key and it will also be increment by 10000

    [/quote]

    In the first one because you couldn't find last record, i would be solved. Like this:

    IF (rec.FINDLAST) THEN

      Number:=rec.Number+1

    ELSE

      Number:=10000;

    You can also use Suresh idea and make one entry of 999 and then autoincrement will work

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Start Integer field from 1000 ???

    Open the table and manually insert a record with value 999.  Then the code or process will automatically increment based on that value so the next value will be 1000....

  • bharathkarunakaran Profile Picture
    bharathkarunakaran 475 on at
    RE: Start Integer field from 1000 ???

    Hi,

    Please go the page where you have added that field and in the properties of that page give autosplitkey = "YES" and you will get you desired output.

    I have  answered upto my understanding.

    Regards,

    Bharath K

    Please mark it as verified if found useful.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Start Integer field from 1000 ???

    @KTA

    actually the main problem is  assign 10000 to primary key and it will also be increment by 10000

  • KTA Profile Picture
    KTA 1,200 on at
    RE: Start Integer field from 1000 ???

    You can try a different approach maybe it isn't the more efficent one but it should work. Instead using autoincrement you can use findlast and if there's one use previous+1 and if not =1000

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Start Integer field from 1000 ???

    KTA picture

    I guess that you've tried InitValue=1000 but that goes against the autoincrement

    InitValue = 1000 not working

    i want just like sales order line, Where Line No. start from 1000

  • KTA Profile Picture
    KTA 1,200 on at
    RE: Start Integer field from 1000 ???

    I guess that you've tried InitValue=1000 but that goes against the autoincrement

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans