将日期时间数组分配给 Domino 表单上的多值日期字段
我正在从视图访问文档,读取日期时间字段,计算两个日期/时间值之间的天数,这两个日期/时间值分为四个类别。在每个类别中都有一个 for 循环,它将多个日期时间值添加到变体数组中。数组条目在 7 到 35 之间。循环之后,我喜欢将数组值分配给表单上的日期时间字段并保存文档。我使用了以下注释项:
Dim nitem as Notesitem
Set nitem = doc.ReplaceItemValue("Datefield", dtArray)
它不起作用。我使用了 doc.ReplaceItemValue "Datefield, dtArray 这个也不起作用。代理运行后该字段为空。我声明了一个变量并将数组分配给该变量,然后将变量分配给表单上的字段:
Dim var1 as variant
var1 = dtArray
doc.datefield = Var1
仍然没有运气查看分配给文档中字段的数组值
这是主循环
Redim dateArray(0)
For i=0 to NumberofDays -1
set notesitem = dtitem.DateTimeValue
call notesitem.AdjustDay(i)
set dateArray(i) = notesitem
Redim preserve dateArray(i+1)
Next
doc.replaceitemvalue "Datefield", dateArray
call doc.save(false, true)
erase dateArray
为什么代理运行后文档中的日期字段是空白的?我应该如何更改它以获得结果?声明如下:
谢谢
I am accessing a document from a view, read a datetime field, figure out number of days between two date/time values which fall into four categories. In each category there is a for loop which add number of datetime values to an array of variant. Array entries are between seven and 35. After the loop I like to assign the array values to a date time field on the form and save the document. I have used Notes item as follow:
Dim nitem as Notesitem
Set nitem = doc.ReplaceItemValue("Datefield", dtArray)
It didn't work. I used doc.ReplaceItemValue "Datefield, dtArray this one didn't work either. The field is blank after the agent runs. I declared a variable and assigned the array to the variable then assigned variable to the field on the form:
Dim var1 as variant
var1 = dtArray
doc.datefield = Var1
Still no luck to see array values assigned to the field in the document
Here is main loop
Redim dateArray(0)
For i=0 to NumberofDays -1
set notesitem = dtitem.DateTimeValue
call notesitem.AdjustDay(i)
set dateArray(i) = notesitem
Redim preserve dateArray(i+1)
Next
doc.replaceitemvalue "Datefield", dateArray
call doc.save(false, true)
erase dateArray
Why after the agent runs datefield in the documents are blank? What is missing? How should I change this to get result. Is it possible to add a delemiter to the assignment statement as follows:
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当您使用
NotesItem
和NotesDateTime
类时,我认为使用NotesItem
DateTimeValue
会带来更多乐趣代码>属性。这是读/写,并返回(或期望)一个NotesDateTime
对象。例如,如果您有一个名为“dt”的
NotesDateTime
实例,则可以通过以下方式将其写回名为“YourDT”的字段:因此,您应该能够获取
数组>NotesDateTime
对象,并使用此方法将其写回相关字段。When you're playing around with
NotesItem
and theNotesDateTime
classes, I think you will have more joy using theNotesItem
DateTimeValue
property. This is read / write, and returns (or expects) aNotesDateTime
object.For example, if you have a
NotesDateTime
instance called "dt", this is how you would write it back to a field called "YourDT":So, you should be able to take your array of
NotesDateTime
objects, and write it back to the relevant field using this approach.从数组中分配 dateTime 字段的最简单方法是:
The simplest way to assign dateTime field from an array is:
这对您来说很难排除故障,因为您没有提供原始源代码。您尝试使用方法的方式有点奇怪。
以下是您正在尝试执行的操作的基本操作。日期时间字段有点棘手,但您可以使用变量数组来设置它们。
我发现在这种情况下最好使用基元,而不是对象。这里发生的事情是我确保日期值存储为日期时间值。然后将数组分配给字段,然后保存文档。有多种方法可以做到这一点,但当您想要将特定类型的数组推入字段时,这是我的首选方法。如果您可以发布原始代码,那么更正您的代码会更容易。
This is tricky to trouble shoot for you, as you haven't provided the original source code. The way your trying to use methods is a bit strange.
Below is a basic go at what you're trying to do. DateTime fields are a bit tricky, but you can set them using variant arrays.
I find it best to work with primitives, not objects in this case. What's happening here is that I am ensuring that the date values are stored as a dateTime value. Then assigning the array to the field and then saving the document. There are a number of ways to do this, but this is my preferred way when you want to push an array of a specific type into a field. If you can post the original code, it would be easier to correct your code.