How do I generate a ID automatically in one of the attributes called ID? I want this ID to be generated when I create a new record entry. I tried make the attribute as 'Indexed" but it doesn't increment it. I don't want this ID to be keyed in by the users.
Also when the user want to add another new record, I want to get the last ID to be retrieve and from that ID I want to add 1 to it and generate a new ID and so on.
Thanks.
Auto generate ID
-
- Posts: 595
- Joined: Sun Apr 24, 2005 2:22 am
- Contact:
Richard,
If you want the ID to be unique across records of a particular object, you can add a rule like the one below to the object. For example, if the object is called Account and the ID attribute is called AccountID, the rule would look like this:
If Account IS NEW Then Account.AccountID = MAX Account.AccountID + 1
This rule will be executed when a new Account record is created and its AccountID will be one greater than the largest AccountID value of all Account records in the database.
Also keep in mind that each object has a pre-defined system-maintained attribute called ID that can be displayed in forms/queries/documents/etc, which is automatically assigned a unique number when any new record is created. This number is unique across all records in the database regardless of the object type and its value cannot be controlled externally. So if you do not have any particular requirements on ID numbering, you can just use the ID attribute without having to add any rules.
If you want the ID to be unique across records of a particular object, you can add a rule like the one below to the object. For example, if the object is called Account and the ID attribute is called AccountID, the rule would look like this:
If Account IS NEW Then Account.AccountID = MAX Account.AccountID + 1
This rule will be executed when a new Account record is created and its AccountID will be one greater than the largest AccountID value of all Account records in the database.
Also keep in mind that each object has a pre-defined system-maintained attribute called ID that can be displayed in forms/queries/documents/etc, which is automatically assigned a unique number when any new record is created. This number is unique across all records in the database regardless of the object type and its value cannot be controlled externally. So if you do not have any particular requirements on ID numbering, you can just use the ID attribute without having to add any rules.
Aware IM Support Team