How do you initialise a global variable, then increment it locally, then update the global?

I am trying to set an integer as a beginning number, say 3234, then each time an invoice is created, that number is used within the title, then incremented and updated globally for the next invoice that is created.

Any ideas?

Thanks.

Subject: Use a profile document

put a number field in a profile document. You can use it then as some kind of global variable.

Subject: RE: Use a profile document

Thanks for the help. WIll try that out.

Subject: RE: Use a profile document

Since profile documents are cached I’m afraid this solution would produce duplicate (rather than sequencial) numbering.

Just a though,

J R

Subject: There’s no problem …

I’m using profile a document for invoice numbering, and it causes no problems. I’m not 100% sure how Profile caching works (It did worry me too …), but I think cache is flushed when writing to a profile document or something like that …

Subject: No solution is perfect …

An issue you could run into using profile documents (or normal documents), is that 2 people change it at the same time, and you get values that are not unique.It’s up to you to calculate the chance for that to happen, they might be very very small (eg. there is only 1 user that can make invoices, …),

cheers,

Tom

Subject: RE: No solution is perfect …

Yeah, I think that the odds are in my favour as there will only be one person creating invoices.

Having a few probs with the profile doc as this is my first experience with them, but learning as I go.

Subject: How do you initialise a global variable, then increment it locally, then update the global?

You’ll need to store it somewhere in between.

The solutions that come to mind are (to store things, accessible for different users) to store it in a document (a normal notesdocument or a profile document), or to dynamically lookup the previous value (using a @dblookup).

Search this forum (or the R5 forum )on ‘unique numbering’ or ‘sequential numbering’ and I’m sure you’ll find something usefull.

cheers,

Tom

Subject: RE: How do you initialise a global variable, then increment it locally, then update the global?

Thanks. I’ll give those options a try.