日期:2014-05-16 浏览次数:20377 次
记录一个放在IBM Domino Notes 数据库视图上的字段值修改公式,已经从有点小BT升级到很有些BT了。
考虑了旧值的备份,简要表的读写,新旧值相等的忽视。
REM {修改字段值.v3 tmpFieldName=字段名称; tmpFieldValue=要赋给该字段的值.}; tmpProfile:="adm_oper_profile"; tmpFieldName:=@GetProfileField(tmpProfile; "lastOPFieldName";"admin") ; tmpFieldValue:=@GetProfileField(tmpProfile; "lastOPFieldVal";"admin") ; NL:=@NewLine; tmpTimestamp:=@ReplaceSubstring(@Text(@Now);"-":":":" ";"":"":"_"); tmpTitle:="TimeStamp:"+tmpTimestamp+NL+NL; tmpFieldName:=@Prompt([OkCancelEdit]; "Enter Field Name "; tmpTitle+"Type Field Name in the box below.";tmpFieldName); tmpFieldValue:=@Prompt([OkCancelEdit]; "Enter Field Value"; tmpTitle+"Type Field Value in the box below."; tmpFieldValue); @If(@GetField(tmpFieldName)=tmpFieldValue; @Return(@Prompt([Ok];"Error";"New Value == Old Value ! SKIP!"+NL+NL+tmpFieldValue)); ""); REM {backup old value}; tmpBakFN:="$bak_"+tmpFieldName; tmpBakFV1:=@GetField(tmpBakFN); tmpBakFV2a:="adm_op_time:"+tmpTimestamp; tmpBakFV2:=tmpBakFV2a:@GetField(tmpFieldName); tmpBakFV:=@If(tmpBakFV1="";tmpBakFV2;tmpBakFV1:tmpBakFV2); @SetField(tmpBakFN;tmpBakFV); REM {change field val}; @SetField(tmpFieldName;tmpFieldValue); @SetProfileField(tmpProfile; "lastOPFieldName";tmpFieldName;"admin") ; @SetProfileField(tmpProfile; "lastOPFieldVal";tmpFieldValue;"admin") ; 1