Common functions for processing multi-Value Domains in notes

Source: Internet
Author: User

 

1. Find the index value of the search content in the multi-value range.
Getitemindex (domain name, Domain value, document)

 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. delete data from multi-Value Domains
Delitemvalues (multi-value domain name, changed index value, Document Object)

 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 'If J is 0, that is, there is only one value. Just give it a null value.  Call Doctt. replaceitemvalue (fieldname, "" ) Exit sub end if  '------------  If Trim (item. Values (0) = ""  Then Index = J End if Index> J Then  'Still add as the last data J = J + 1 'Index bit only increases by 1 Index = J'Redefine the index bit to prevent exceeding the range  End if redim Temp (J-1) As Variant  'Redefinition Array  For I = 0 To Index-1 temp (I) = item. Values (I) Next I = index To J-1 temp (I) = item. Values (I + 1) Next call Doctt. replaceitemvalue (fieldname, temp) 'End if' end if  End sub 

 

3. Change Data in a multi-value domain
Edititemvalues (multi-value domain name, changed index value, changed content, Document Object)

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 Index> J Then 'Still add as the last data J = J + 1 'Index bit only increases by 1 Index = J 'Redefine the index bit to prevent exceeding the range End if redim Temp (j)As Variant 'Redefinition Array 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

 

 

1. Find the index value of the search content in the multi-value range.
Getitemindex (domain name, Domain value, document)

 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 = 0To J If Itemval = item. Values (I) Then Getitemindex = I Exit function end if next Getitemindex =-1 End Function

 

2. delete data from multi-Value Domains
Delitemvalues (multi-value domain name, changed index value, Document Object)

 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  'If J is 0, that is, there is only one value. Just give it a null value.  Call Doctt. replaceitemvalue (fieldname,"" ) Exit sub end if  '------------  If Trim (item. Values (0) = ""  Then Index = J End if Index> J Then  'Still add as the last data J = J + 1 'Index bit only increases by 1 Index = J 'Redefine the index bit to prevent exceeding the range  End if redim Temp (J-1) As Variant 'Redefinition Array  For I = 0 To Index-1 temp (I) = item. Values (I) Next I = index To J-1 temp (I) = item. Values (I + 1) Next call Doctt. replaceitemvalue (fieldname, temp) 'End if' end if  End sub 

 

3. Change Data in a multi-value domain
Edititemvalues (multi-value domain name, changed index value, changed content, Document Object)

 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 Index> J Then 'Still add as the last data J = J + 1 'Index bit only increases by 1 Index = J 'Redefine the index bit to prevent exceeding the range End if redim Temp (j) As Variant 'Redefinition Array 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

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.