I ment,
Just make a new Int-Field and chose Autoincrement = TRUE.
That´s all and you don´t need Code at all!
Sure - I know the order of this field is not equal to the order of Companies if you don´t insert them in alphabetical order, but if you do so, why writing Code?
And one Company always has the same ID during existing in database...
But I think cloudenine just wanted to know IF this ID exists??
And this question we have already answered =D>
@Waldo:
Just interested: What code dou you would write?
giving an example:
Adding following Companies (in writting Order):
A , X, L, B
what ID they have after your code?
@Waldo:
Just interested: What code dou you would write?
:-k
Just from the top of my head ...
- add new integer field to company table
- add key on this field
- OnInsert write code:
- sort on integer field (Seperate record variable )
- get last ID
- Generate New ID
- Add this ID to current record
giving an example:
Adding following Companies (in writting Order):
A , X, L, B
what ID they have after your code?
Comments
I just know CompanyName, no ID.
(even that you have to use Name for Changing Company)
-> take a look at Table 2000000006 (Company)
you can create an extra column in that table (CompanyNo) if you want ... and even write some validation-code behind it.
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
but let NAV make it for you with autoincrement
- I don´t think you always want to Insert & Delete Companies
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
I ment,
Just make a new Int-Field and chose Autoincrement = TRUE.
That´s all and you don´t need Code at all!
Sure - I know the order of this field is not equal to the order of Companies if you don´t insert them in alphabetical order, but if you do so, why writing Code?
And one Company always has the same ID during existing in database...
But I think cloudenine just wanted to know IF this ID exists??
And this question we have already answered =D>
@Waldo:
Just interested: What code dou you would write?
giving an example:
Adding following Companies (in writting Order):
A , X, L, B
what ID they have after your code?
Waldo thanks also to you but we dont want to alter the navision tables/database...
Thanks
:-k
Just from the top of my head ...
- add new integer field to company table
- add key on this field
- OnInsert write code:
- sort on integer field (Seperate record variable
- get last ID
- Generate New ID
- Add this ID to current record
A=1
X=2
L=3
B=4
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
You get the same result, when you just set the "AutoIncrement"-property of Field "ID" to yes
but I don't like Autoincrement...
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog