Using Formula language code to generate unique reference numbers

Tags:
Formula Language
Lotus Notes
I need to generate a unique reference number for every new Lotus Notes document that is captured. I want to use some Formula language code. Can anyone help me to get started?

Answer Wiki

Thanks. We'll let you know when a new response is added.

I use a computed text field on the form with the following code

calc := @TextToNumber(@Word
(@Implode(@Text(@DbColumn
(“Notes” : “NoCache”; “”; “(DocNumber)”; 1))); ” “; 1))
+ 1; @If(@IsNewDoc;@If(@IsError(calc); “0000”+”1″;
@If(@Length(@Text(calc))=1;”0000″+@Text
(calc);@Length(@Text(calc))=2;”000″+
@Text(calc);@Length(@Text(calc))=3;”00″+
@Text(calc);@Text(calc))); DocNumber)

Where DocNumber is the name of the field and (DocNumber) is the name of a view created.
The view (DocNumber) must include the DocNumber field from the form only and this needs to be arranged in descending order.
Hope this helps.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following