manually increasing id field

Hi, i defined a group table with groupid, groupname, narrative fields.

i will create a form with disabled groupid field.

Other fields could be entered by user.

If table has no records groupid will be 1, else last groupid + 1.

firstly, is this logical? if yes, is this able to make? and if yes, how?

Best regards.

Hi

You can do this in a couple of ways - via number series management by creating a number series for this specific table or through a manual code increment when a new record is inserted, Nav code checks for the last number used.

Number series tidier!

Neil

hi, i’ve done it like below.

http://dynamicsuser.net/blogs/mark_brummel/archive/2009/12/13/tip-26-implementing-no-series.aspx

but is this the easiest way to do or is there any way to do easier?

because it’s very complicated for me.

Best regards.

Zaim

This is the proper way to do it but there is an easier way.

Either set a trigger in the OnInsert area of your new table to find last entry on same table or add some code to the default form / page set for your new table.

Web link for screen shots below:

http://www.dynamicsnavukhelp.co.uk/forum-screen-shot-links/

I would also set the form to DelayInsert and PopulateAllFields - assuming you are using Nav 2009 Classic or before. Same code will work for pages as the code sits on your new table.

Neil