Lotus Notes Domino API - 从公式生成值

发布于 2024-09-25 15:51:43 字数 311 浏览 2 评论 0原文

这对您来说是一个困难:我有一个 NotesForm 对象,并且获得了整个结构,包括字段的默认值,其中一些是公式。现在,我正在使用代码为该表单创建一些 NotesDocument 对象。我事先不知道 NSF 的结构 - 仅在运行时,数据库可以来自任何地方。所以,这意味着我也不知道公式是什么。

现在,我想知道的是:有没有一种方法可以将我从默认值(例如:@Today)读取的一些公式文本传递到 Notes 并获取该公式的结果?然后我可以在生成文档时使用该值。就目前情况而言,如果这些字段是通过 Notes 客户端输入的,那么它们完全可以有默认值,但它们却是空白的。

有什么想法吗?

Here's a tough one for you: I have a NotesForm object and I got the entire structure, including default values for fields, of which some are formulas. Now, I am creating some NotesDocument objects for that form using code. I have no idea of the structure of the NSF beforehand - only at runtime, The database can come from anywhere. So, that means I also don't know what the formula is either.

Now, what I want to know is: Is there a way I can pass some formula text that I have read from a default value (for example: @Today) to Notes and get the result back for that formula? Then I can use that value when generating my document. As it stands, these fields are blank when they could perfectly well have had a default value if they had been entered via the Notes client.

Any ideas?

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

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

发布评论

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

评论(1

来世叙缘 2024-10-02 15:51:43

您可以使用评估函数/方法。如果您在 Notes/Domino 环境中使用 LotusScript 进行操作,则可以使用如下内容:

Dim result As Variant
result = Evaluate(formulaString [,doc])

NotesDocument 对象,doc int 上述代码段是可选的,但如果您正在计算使用数据的公式,则这是必需的来自特定文档。您不需要使用它来评估@Today,但是如果您的公式使用来自另一个字段的值,那么您需要告诉公式语言引擎要使用哪个文档(它没有上下文提示) “纯公式”情况)。

如果您使用 COM 或 Java,则 Evaluate 语句不是该语言的一部分,因此它被视为 Notes 会话对象的方法。

Evaluate 原生返回一个 Variant,通常包含一个 Array(也可能返回一个错误值)。在 LotusScript 中,如果您期望返回单个标量值,请使用 Variant 并采用第零个索引。在 VB classic 或 VBA 中,它将是一个变体。在 .NET 中,它是一个对象;在 Java 中它将是一个向量。

You can use the Evaluate function/method. If you are operating from LotusScript within the Notes/Domino environment, you can use something like this:

Dim result As Variant
result = Evaluate(formulaString [,doc])

The NotesDocument object, doc int the above snippet, is optional but necessary if you are evaluating a formula that uses data from a specific document. You wouldn't need to use it to evaluate @Today, but if your formula uses a value from another field, then you need to tell the formula language engine which document to use (it doesn't have the context hint it would have in a "pure formula" situation).

If you are using COM or Java, the Evaluate statement isn't part of the language, so it is addressed as a method of the Notes session object.

Evaluate returns a Variant natively, usually containing an Array (it may also return an error value). In LotusScript, use a Variant and take the zeroth index if you are expecting a single scalar value back. In VB classic or VBA, it will be a Variant. In .NET, it's an Object; in Java it will be a vector.

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