上述错误的原因是因为'FinishDate'字段为空,这是可以理解的。 我在循环中尝试做的是用今天的日期替换任何空的'FinishDate'字段。
'FinishDate'将持续进行,直到活动正确结束,即生成endDate并在文档中填充'FinishDate'字段。
我尝试了下面的工作,只是循环通过NotesDocument,但没有使用NotesDocumentCollection:
trait In
object s {
import scala.reflect.runtime.universe._
def apply[A <: In, B <: In](a: A, b: B) = foo(a, b)
def apply[A <: AnyVal : Numeric, B <: In](a: A, b: B)(implicit ev: TypeTag[B]) = foo(numeric(a), b)
def apply[A <: In, B <: AnyVal : Numeric](a: A, b: B)(implicit ev: TypeTag[A]) = foo(a, numeric(b))
def apply[A <: AnyVal : Numeric, B <: AnyVal : Numeric](a: A, b: B) = foo(numeric(a), numeric(b))
}
case class numeric[B <: AnyVal : Numeric](b: B) extends In
case class foo[A <: In, B <: In](a: A, b: B) extends In {}
def usage = {
// these still work:
s(3, numeric(5))
s(3, 7)
s(6, 19.4)
s(s(1, 1.1), 9.1)
// now these work too:
s(34.4, 1.1)
s(1.3f, 1.1)
s(1.2, 123)
// and this doesn't - as expected:
s(1, "bad!")
}
每次运行时都会跳过'else'语句。
以下是完整代码和错误块。
try {
var endDate:NotesDateTime = null;
if(!docEv.getItemValue("FinishDate").isEmpty()){
endDate = docEv.getItemValue("FinishDate").elementAt(0);
}else{
endDate = session.createDateTime(@Now());
}
}catch(e){
print("endDate: " + e.toString())
}
}
我们将不胜感激。
答案 0 :(得分:2)
您正在循环遍历NotesDocumentCollection,但您在视图而不是文档集合上使用getNextDocument。所以用getNextDocument将你的行更改为:
var tmpdocEv = dcEv.getNextDocument(docEv);