web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Table Field propert "autoincrease" Issue and lookup issue.

(0) ShareShare
ReportReport
Posted on by

Hi All,

I have create a table object and one of the field sets "Autoincrement" as True. This field is used for a list and with I new a record, the field will increase by one. However, when I delete all of the recored for the list, this field will not go back to 0.

For example. I have record 1,2 and 3. The Field have value 1, 2 and 3 for each record. After I delete all the record and create a new one. The field value become 4 with the new record. I expect it go back again and start with 1. Does anyone know how to do that?

Thanks in advance.

Categories:
I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    This is standard for an autoincrement field. It simply autoincrement itself on every record creation.

    For your scope, I suggest you to create an integer field and then handle its value via code (OnInsert trigger).

    Something like:

    OnInsert()

    if MyTable.FINDLAST THEN

     Field := MyTable.Field +1

    ELSE

     Field := 1;

  • Community Member Profile Picture
    on at

    Thank you Stefano. That is what I want.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans