如何为笔记文档创建人类可读的密钥

发布于 2024-07-23 14:26:21 字数 72 浏览 5 评论 0原文

对于存储在数据库中的文档,我想创建一个人类可读的密钥来唯一标识该文档。 例如 PO20090110-001。 我该如何去做呢?

For the documents stored in the database, I would like to create a human readable key to uniquely identify the document. e.g. PO20090110-001. How do I go about doing that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

愿与i 2024-07-30 14:26:21

保存文档时,您可以使用日期或您喜欢的任何技术将数字的第一部分放在一起(例如“PO”和格式(日期,“YYYYMMDD”)和confDoc.getitemvalue(“doccounter”)) 。

至于计数器,我喜欢将其存储在配置文档中,并在保存每个文档时更新它。 如果白天创建了很多文档,您可能会在配置文档上遇到代表冲突,如果是这种情况,您可以让服务器上的代理进行实际的号码分配,这样做的缺点是您不需要保存时无法立即获取号码。

希望这可以帮助。

When saving a document you can put together the first part of the number by using the date or any technique you like (ej. "PO" & format(date, "YYYYMMDD") & confDoc.getitemvalue("doccounter")).

As for the counter I like to store it in a configuration document and update it when each doc is saved. If there are lots of documents created during the day you can run into rep conflicts on you configuration document, if this is the case you can have an agent on the server do the actual assigning of the number, the drawback to this is that you don't get the number right away when saving.

Hope this helps.

花桑 2024-07-30 14:26:21

这并不简单。

为唯一密钥创建字段,并在保存(或其他事件)时保存该密钥,但必须保护该数字是唯一的。

您可以创建代理,该代理检查 domino 服务器上的号码,如果代理发现冲突,则通知应用程序管理员或其他责任人员解决此问题。

或者每个副本生成自己的编号,并在多米诺骨牌上复制后,代理以正确的格式分配编号。

It's not simply.

Create field for uniquely key and this key saving onSave (or other event), but you must protect this number to be unique.

You can create agent, which checking number on domino server and if agent find conflict then notify application administrator or other responsibility person to resolve this.

Or each replica generate own number and after replicate on domino, agent assign number in right format.

雅心素梦 2024-07-30 14:26:21

我们帮助台中使用的一种解决方案是获取当前用户的姓名缩写并将其添加到视图中最后一个文档的编号中。 将数字加一,并将其​​与缩写和新数字一起存储为新文档作为密钥。

One solution used in our help desk is to take the initials of the current user and add it to the a number in the last document in a view. Add one to the number and store that it the new document along with the ititals and the new number as the key.

雨夜星沙 2024-07-30 14:26:21

只需使用 @Unique 函数(不带任何参数)即可在 Domino 中创建“几乎”唯一的键。 这将根据当前用户的名字和姓氏以及当前时钟时间生成一个字符串键。 您最终会得到一个类似于“ESCR-12345678”的字符串。

我说“几乎”唯一,因为它实际上并不像 SQL 中的标识列 - Domino 不保证它只会给出一个特定的字符串一次。 如果您在一次生成许多 id 的服务器端代理中使用 @unique - 例如,以及循环并在循环内使用 @unique 的代理,您可能会遇到 @unique 将返回重复项的情况 - 因为您创建同一秒内有 2 个文档,因为您的“用户名”始终是服务器的规范名称。 但是,在这种情况之外,@unique 通常可以安全使用。

如果您随后需要通过此 ID 打开或引用文档,只需创建一个按该 ID 排序的视图,然后您就可以使用 ../myView/id?readDocument 形式的 url。

You can create a "nearly" unique key in Domino simply by using the @Unique function, with no arguments. This will generate a string key, based on the current user's first and last name and the current clock time. You will end up with a string something like: "ESCR-12345678".

I say "nearly" unique, because it is not really like an identity column in SQL - Domino does not guarantee it will only give out a particular string once. If you use @unique in a server-side agent which generates many id's at once - for example, and agent that loops and uses @unique within the loop, you can get into a situation where @unique will return a duplicate - because you create 2 docs within the same second and because your "username" is always the server's canonical name. But, outside of that scenario, @unique is generally safe to use.

If you then need to open or reference docs by this ID, just create a view sorted by that ID and you can a url in the form ../myView/id?readDocument.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文