Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a Unique ID Field

Status
Not open for further replies.

AllanBowker

IS-IT--Management
Aug 8, 2001
57
0
0
GB
I have a database with a list 13,000+ companies in it.
I would like to now add an "Account Number" field into it starting from 1000.

I know how to add a field to a form and I guess I would populate the field with an agent. I'm not sure about the formula though.

Can anyone help?
I will give a star to anyone who solves this for me.
Thanks
 
Hi,
it depends on if you want have the field in all the companies filled out on begining.

If you add a new field in a form with "Editable" option and 1000 as default value, the representing data item of the field "Account Number" with default value 1000 is added to each document only if the document is created or opened for editing and saved (using the form you modified).

If you want all the companies to have data item "Account Number" at one time, you have to write a script/action/agent and add the data item "Account Number" in each document manually. To access and change this data item, you have also to have the form modified and the field "Account Number" with "Editable" optioon added in.

I hope that I have anderstand you and answered your question. My english isn't too good.


Good luck
Mortan
 
I need to take record 1 and give it an account number 1000, then take record 2 and give it 1001, etc.

The default value of a new record would automatically take the next available number as an automatic count.

Does this clarify?

 
Aah so,

build an agent and write this script into it:

dim s as new NotesSession
Dim AllDocs as NotesDocumentCollection
Dim Doc as NotesDocument
REM I suppose all the docs in the database are companies
set AllDocs = s.CurrentDatabase.AllDocuments
for i=1 to Docs.Count
set Doc = Docs.GetNthDocument(i)
Doc.AccountNumber = 999+i
Doc.Save True,False
REM Check Save functionparameters if True,False is fine
next

I hope this is what you need. I didn't debug the script, but it should work fine.

good luck
Mortan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top