如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
Notes中几个处理多值域的通用函数1.查找出查找内容在多值域中的索引值getItemIndex(域名,域值,文档)PublicFunctiongetItemIndex(ByValfieldNameAsString,ByValitemValAsObject,ByValdocttAsNotesDocument)AsIntegerDimiAsIntegerDimjAsIntegerDimitemAsNotesItemitem=doctt.GetFirstItem(fieldName)j=Ubound(item.Values)Fori=0TojIfitemVal=item.Values(i)ThengetItemIndex=iExitFunctionEndIfNextgetItemIndex=-1EndFunction2.删除多值域中的数据delItemValues(多值域名,更改的索引值,所在文档对象)PublicSubdelItemValues(ByValfieldNameAsString,ByValindexAsInteger,ByValdocttAsNotesDocument)DimiAsIntegerDimtemp()AsObjectDimitemAsNotesItemitem=doctt.GetFirstItem(fieldName)DimjAsIntegerj=Ubound(item.values)'-----------Ifj=0Then'当J为0时,即仅有一个值,给予空值即可Calldoctt.ReplaceItemValue(fieldName,"")ExitSubEndIf'------------IfTrim(item.Values(0))=""Thenindex=jEndIfIfindex>jThen'仍然做为最后一个数据加入j=j+1'索引位仅增加1index=j'重定义索引位,防止超出范围EndIfRedimtemp(j-1)AsVariant'重定义数组Fori=0Toindex-1temp(i)=item.values(i)NextFori=indexToj-1temp(i)=item.values(i+1)NextCalldoctt.ReplaceItemValue(fieldName,temp)'EndIf'EndIfEndSub3.更改多值域中的数据editItemValues(多值域名,更改的索引值,更改的内容,所在文档对象)PublicSubeditItemValues(ByValfieldNameAsString,ByValindexAsInteger,ByValitemValAsObject,ByValdocttAsNotesDocument)DimiAsIntegerDimtemp()AsObjectDimitemAsNotesItemitem=doctt.GetFirstItem(fieldName)DimjAsIntegerj=Ubound(item.values)IfTrim(item.Values(0))=""Thenindex=jEndIfIfindex>jThen'仍然做为最后一个数据加入j=j+1'索引位仅增加1index=j'重定义索引位,防止超出范围EndIfRedimtemp(j)AsVariant'重定义数组Fori=0TojIfi=indexThentemp(i)=itemValElsetemp(i)=item.values(i)EndIfNextCalldoctt.ReplaceItemValue(fieldName,temp)'EndIf'EndIfEndSub