如何在 GetAllEntriesByKey 中使用数组中的日期?
我试图通过传递数组来使用 GetAllEntriesByKey 中的当前日期。 到目前为止,数组看起来像这样,
Dim keyarray(2) As Variant
keyarray(0) = "FF Thompson ADT"
Set keyarray(1) = dateTime
我想说的是,
Set vc = view.GetAllEntriesByKey(keyarray, False)
这是一行它工作时的样子。 测试代理在电子邮件中打印出 csv。
FF Thompson ADT,2/3/2009,11:45:02 PM,0,6,0,,00:00:04,5400,4
我似乎无法传递当前运行的日期时间。 我可以在声明中手动设置日期时间并且它可以工作。 我认为这是因为它也想打发时间,但我不知道。 我已经尝试了三种方法,它说无效的键值类型。
Dim dateTime As New NotesDateTime("")
Call dateTime.LSLocalTime = Now
...
keyarray(1) = dateTime.Dateonly
Dim dateTime As New NotesDateTime("")
Call dateTime.SetNow
...
keyarray(1) = dateTime.Dateonly
Dim dateTime As New NotesDateTime("Today")
...
keyarray(1) = dateTime.Dateonly
我不知道这是否有用,但我读到了 Evaluate 在这里。
我最终想做的是 GetFirstEntry 获取“FF Thompson ADT”,以获取最近一天的条目。 前一天我也尝试做同样的事情。 我试图使用类似的方法来总结这两天处理的文件(数字 6)和最近一天的错误(空)。 我需要调整它,以便它找到已处理的文件和条目错误,但我还没有到达那里,但应该能够做到。 我也只是想找到提要的最新日期和时间值,即“FF Thompson ADT”。
Set entry = vc.GetFirstEntry
filesprocessed = 0
Dim errors, errortotal As Integer
errors = 0
errorstotal = 0
While Not entry Is Nothing
rowval = 0
errors = 0
Forall colval In entry.ColumnValues
If rowval > 0 Then
errors = Cint(colval)
Else
rowval = Cint(colval)
End If
End Forall
filesprocessed = filesprocessed + rowval
errorstotal = errorstotal + errors
Set entry = vc.GetNextEntry(entry)
Wend
感谢您的任何帮助或建议。 他们非常感激。
I'm trying to use the current day in GetAllEntriesByKey by passing an array. The array so far looks like this
Dim keyarray(2) As Variant
keyarray(0) = "FF Thompson ADT"
Set keyarray(1) = dateTime
I would like to say this
Set vc = view.GetAllEntriesByKey(keyarray, False)
Here is a row of what it looks like when it works. The test agent prints out csv in an email.
FF Thompson ADT,2/3/2009,11:45:02 PM,0,6,0,,00:00:04,5400,4
I can't seem to pass a current day dateTime that runs. I can set the dateTime manually in the declaration and it works. I think it's because it's trying to also pass the time but I don't know. I have tried three ways and it says invalid key value type.
Dim dateTime As New NotesDateTime("")
Call dateTime.LSLocalTime = Now
...
keyarray(1) = dateTime.Dateonly
Dim dateTime As New NotesDateTime("")
Call dateTime.SetNow
...
keyarray(1) = dateTime.Dateonly
Dim dateTime As New NotesDateTime("Today")
...
keyarray(1) = dateTime.Dateonly
I don't know if this is useful but I read about Evaluate here.
What I'm ultimately trying to do is GetFirstEntry for "FF Thompson ADT" for the most recent day entries exist. I'm also trying to do the same for the day before that. I'm trying to sum up the files processed (the number 6) for both days and errors (the null) for the most recent day using something like this. I need to tweak it so it finds the files processed and errors for entries but I haven't gotten there but should be able to do. I'm also just trying to find the most recent date with time value for the feed ie "FF Thompson ADT".
Set entry = vc.GetFirstEntry
filesprocessed = 0
Dim errors, errortotal As Integer
errors = 0
errorstotal = 0
While Not entry Is Nothing
rowval = 0
errors = 0
Forall colval In entry.ColumnValues
If rowval > 0 Then
errors = Cint(colval)
Else
rowval = Cint(colval)
End If
End Forall
filesprocessed = filesprocessed + rowval
errorstotal = errorstotal + errors
Set entry = vc.GetNextEntry(entry)
Wend
Thanks for any help or suggestions. They are greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我只使用了带有字符串数组的 GetAllEntriesByKey 方法。 我从未尝试过混合类型。 但假设不同的类型对该方法有效,问题可能在于 Notes 中日期时间类型之间的差异。 有一个核心 LS 日期时间类型,然后有一个 NotesDateTime 对象。 我敢打赌该视图认为日期列是由核心日期时间类型组成的,因此当您传递 NotesDateTime 类型时它会失败。
但撇开这个问题不谈,我的建议是创建一个包含您想要访问的列的视图,并将第一列(包含 FF Thompson ADT)的排序顺序设置为 asc,然后将包含日期的第二列设置为 desc。 然后,您可以按照您想要的顺序访问视图条目,最近的为第一个,第二个最近的为第二个,依此类推。
如果 GetAllEntriesByKey 方法有机会返回乱序的文档(我忘记它是否保证顺序),我知道我在使用 NotesViewNavigator 类之前已经完成了此操作。 肯定有一种替代方法可以做到这一点,而无需使用日期键调用 GetAllEntriesByKey。
I've only used the GetAllEntriesByKey method with an array of strings. I've never tried mixing types. But assuming differing types are valid for that method, the problem might lie in the difference between datetime types in Notes. There's a core LS datetime type and then there's a NotesDateTime object. I'd bet the view considers a date column to be made up of the core datetime types, and so it fails when you pass the NotesDateTime type.
But that issue aside, my suggestion is to create a view that has the columns you want to access, and set the sort order of the first column (containing FF Thompson ADT) to asc, then set the second column with your dates to desc. You can then access the view entries in the order you want, with the most recent being first, 2nd most recent 2nd, etc.
If by some chance the GetAllEntriesByKey method returns the documents out of order (I forget if it guarantees order), I know I've done this before using the NotesViewNavigator class. There's definitely an alternate way to do it without need to call GetAllEntriesByKey with the date key.
这是我找到的答案
Here's an answer I found