如何更改文档的字段值(LotusScript)?

发布于 2024-08-19 12:29:10 字数 666 浏览 4 评论 0原文

在新的 LotusNotes 表单中,我有一个计算值字段(“NewOrdProdUID”),该字段使用另一个现有文档的唯一 ID 正确设置。 我想通过 LotusScript 更改现有文档中“NewProdAvail”字段的值。我尝试这样做:

Sub Querysave(Source As Notesuidocument, Continue As Variant)
 Dim session As NotesSession
 Dim db As NotesDatabase
 Dim ws As New NotesUIWorkspace
 Dim uidoc As notesUIDocument
 Dim odoc As notesDocument 

 Set session = New NotesSession
 Set db = session.CurrentDatabase
 Set uidoc = ws.CurrentDocument

 Set odoc = db.GetDocumentByUNID(uidoc.FieldGetText("NewOrdProdUID"))
 Call odoc.FieldSetText("NewProdAvail", "0")
 Call odoc.Save(True, True)
End Sub

但是“NewProdAval”字段的值保持不变(在我的例子中为 3,而不是 0)。 请帮我!

In a new LotusNotes form I have a computed-value field ("NewOrdProdUID") which is set correctly with the unique ID of another existing document.
I want to change the value of the field "NewProdAvail" in the existing document by means of LotusScript. I tried with this:

Sub Querysave(Source As Notesuidocument, Continue As Variant)
 Dim session As NotesSession
 Dim db As NotesDatabase
 Dim ws As New NotesUIWorkspace
 Dim uidoc As notesUIDocument
 Dim odoc As notesDocument 

 Set session = New NotesSession
 Set db = session.CurrentDatabase
 Set uidoc = ws.CurrentDocument

 Set odoc = db.GetDocumentByUNID(uidoc.FieldGetText("NewOrdProdUID"))
 Call odoc.FieldSetText("NewProdAvail", "0")
 Call odoc.Save(True, True)
End Sub

However the value of the field "NewProdAval" stays the same (3 in my case, not 0).
Please, help me!

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

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

发布评论

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

评论(4

云仙小弟 2024-08-26 12:29:10

奇怪的是,看来你也应该得到一个错误。您正在 NotesDocument 对象 (odoc) 上调用 NotesUIDocument 的前端方法,并且 NotesDocument 类没有名为“FieldSetText”的方法。这应该可以解决问题:

不要调用 odoc.FieldSetText("NewProdAvail", "0"),而是尝试这个

Call odoc.ReplaceItemValue("NewProdAvail", "0")

希望这有帮助!

Strange, it seems like you should be getting an error too. You are calling a front-end method for NotesUIDocument on your NotesDocument object (odoc), and the NotesDocument class does not have a method called "FieldSetText". This should fix the problem:

Instead of Call odoc.FieldSetText("NewProdAvail", "0"), try this

Call odoc.ReplaceItemValue("NewProdAvail", "0")

Hope this helps!

青衫负雪 2024-08-26 12:29:10

NotesDocument 类没有 FieldSetText 方法。您可以使用:

odoc.replaceItemValue ("NewProdAvail", "0")

或简单地:

odic.NewProdAvail = "0"

The NotesDocument class does not have a FieldSetText method. You can use:

odoc.replaceItemValue ("NewProdAvail", "0")

or simply:

odic.NewProdAvail = "0"
明媚殇 2024-08-26 12:29:10

前面的回答,告诉你如何在后端文档上设置字段。我认为值得一提的是后端和前端是如何工作的。

在为 Lotus Notes 客户端编码时,您需要记住 Notes 文档具有前端和后端组件。基本上,Lotus Client 中的Notes 文档都有一个前端内存版本和相应的后端内存版本。更改应在查询保存期间传播到后端,然后通过前端提交所做的更改。

因为前面的答案向您展示了如何直接更改后端文档,所以您还应该注意 NotesUIDocument 类上的“autoload”属性。 链接很好地解释了这一点。其他可以“篡改”字段值设置的因素包括受影响字段中的公式以及该字段是否已计算或可编辑。

希望这有帮助。

The previous answers, tell you how to set the field on the back-end document. I think it worth mentioning how the back-end and front-end work.

When coding for the Lotus Notes client you need to remember that a Notes document has a front-end and back-end components. Basically, Notes documents in the Lotus Client has a front-end memory version and a corresponding back-end memory version as well. Changes should propagate to the back end during querysave and then commit the changes you make via the front-end.

Because the previous answers are showing you how to change the back-end document directly, you should also be aware of the "autoload" property on the NotesUIDocument class. This link explains it well. Other things that can "tamper" with the setting of field values, are formula in the effected fields, and whether the field is computed, or editable.

Hope this helps.

筱武穆 2024-08-26 12:29:10

我用过

Set Item = odoc.replaceItemValue ("NewProdAvail", restAvailable)
Call odoc.Save(True, True)

并且有效。谢谢你们的帮助!

I used

Set Item = odoc.replaceItemValue ("NewProdAvail", restAvailable)
Call odoc.Save(True, True)

and it worked. Thank you guys for the help!

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