How to create an auto incrementing field in lotus domino?

前端 未结 4 2021
面向向阳花
面向向阳花 2020-12-07 04:22

I have an application in lotus domino with a field

UNIDID-number(computed)...

I want that every time a new entry is created, this field to inc

4条回答
  •  醉酒成梦
    2020-12-07 05:23

    To answer your specific question:

    lastEntry := @Subset(mFind;-1); "UNID" + lastEntry;

    But here are a couple of things you should think about:

    1. "UNID" is a term that has a very specific meaning in Notes and Domino. It refers to the Universal ID that is automatically assigned to every document in every database. If you use this term in your application for another purpose, you are likely to cause confusion someday when some other Notes expert has to look at your application.

    2. The best way to assign a sequential id is to let the server do it for you. I.e., save the document with an empty field, and create an agent that runs on new and edited documents, checks for the empty field, and assigns the next available id if necessary. Since only one agent can run in the database at a time, and it works on only one document at a time, this guarantees that you can't possibly have two documents that are saved simultaneously with the same unique id. The downside of this is that you can't show the user the sequential id before the agent gets a chance to run.

提交回复
热议问题