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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Right Track with @Environment?

Status
Not open for further replies.

BlackHawk2

Technical User
Jan 29, 2002
124
US
I am using the following to increment a text field:

OldOrderNumber := @Environment("OrderNumber");
NewOrderNumber := @TextToNumber(@If(OldOrderNumber = ""; "0"; OldOrderNumber)) + 1;
ENVIRONMENT OrderNumber := @Text(NewOrderNumber);
NewOrderNumber;

The problem is that it stores it only to the local notes.ini. Is there a way to have this stored and read by the server?

Or is this not a good way to increment a field??? Will this give me problems if more than one user trys to create a new document at once? or is it better than telling it to look at the last document and adding one? wouldn't that create duplicates?

BH2
 
The process you identify will certain only gain the next order number from that user's PC. Useless if multiple clients are using it! You could, however, move the formula to the server (ie agent run by the server) utilising the server's .ini file. That way, everyone will pick up a number from a consistant source.

The other way you mention using a script to get the lastdocument will also work, but as you say, depending on the usage, it could cause problems for dbs that have a high usage.

Personally, for order numbers, I try and use the @Unique command where ever possible.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top