Notes中幾個處理多值域的通用函式

2021-09-08 23:37:48 字數 2469 閱讀 4755

1.查詢出查詢內容在多值域中的索引值

getitemindex(網域名稱,域值,文件)

public function getitemindex(byval fieldname as string, byval itemval as object, 

byval doctt as notesdocument) as integer

dim i as integer

dim j as integer

dim item as notesitem

item = doctt.getfirstitem(fieldname)

j = ubound(item.values)

for i = 0 to j

if itemval = item.values(i) then

getitemindex = i

exit function

end if

next

getitemindex = -1

end function

2.刪除多值域中的資料

delitemvalues(多值網域名稱,更改的索引值,所在文件物件)

public sub delitemvalues(byval fieldname as string, byval index as integer, byval doctt as notesdocument)

dim i as integer

dim temp() as object

dim item as notesitem

item = doctt.getfirstitem(fieldname)

dim j as integer

j = ubound(item.values)

'-----------

if j = 0 then

'當j為0時,即僅有乙個值,給予空值即可

call doctt.replaceitemvalue(fieldname, "")

exit sub

end if

'------------

if trim(item.values(0)) = ""

then

index = j

end if

if index > j then

'仍然做為最後乙個資料加入

j = j + 1 '索引位僅增加1

index = j '重定義索引位,防止超出範圍

end if

redim temp(j-1) as variant

'重定義陣列

for i = 0 to index - 1

temp(i) = item.values(i)

next

for i = index to j - 1

temp(i) = item.values(i + 1)

next

call doctt.replaceitemvalue(fieldname, temp)

'end if

'end if

end sub

3.更改多值域中的資料

edititemvalues(多值網域名稱,更改的索引值,更改的內容,所在文件物件)

public sub edititemvalues(byval fieldname as string, byval index as integer, byval itemval as object, 

byval doctt as notesdocument)

dim i as integer

dim temp() as object

dim item as notesitem

item = doctt.getfirstitem(fieldname)

dim j as integer

j = ubound(item.values)

if trim(item.values(0)) = ""

then

index = j

end if

if index > j then

'仍然做為最後乙個資料加入

j = j + 1 '索引位僅增加1

index = j '重定義索引位,防止超出範圍

end if

redim temp(j) as variant

'重定義陣列

for i = 0 to j

if i = index then

temp(i) = itemval

else

temp(i) = item.values(i)

end if

next

call doctt.replaceitemvalue(fieldname, temp)

'end if

'end if

end sub

Notes中幾個處理多值域的通用函式

getitemindex 網域名稱,域值,文件 public function getitemindex byval fieldname as string,byval itemval as object,byval doctt as notesdocument as integer dim i a...

QT中關於JSON處理的幾個類

原文 qjsonobject類封裝了乙個json物件。乙個json物件是乙個包含了許多key value pair的列表。這裡的key都是unique string,而value都是qjsonvalue.乙個qjsonobject可以被轉換成乙個qvariantmap.可以用size 來獲得key ...

幾個pandas資料處理中的常用操作

記幾個常用的函式,具體用法去官網查啦 import的慣例 import pandas as pd from pandas import series,dataframe 顯示一些數字特徵 df.describe 顯示很多,均值,標準差,分位數等等 df.quantile 0.75 顯示3 4分位數 ...