Manage Learn to apply best practices and optimize your operations.

Get List Intersect

@Replace works great to get rid of items in a list that match, but what about
when you need those matching values. You probably are saying, this is easy to
do. In @formula language, sure but in LotusScript it is a little harder. Here
is a sample function as to how to do it.

This is great when you need to add users to a readers name field or recipients
for an email. There is also the ability, by setting a parameter, to add
additional names to the list (i.e. default roles or users)
Function GetListIntersect(List1 As Variant, UserRecipients, FromName,
AddAdditional As String) As Variant

' List1 is the Recipient List that has been converted
' UserRecipients are the Allowed Recipients for the user

Dim List2 As Variant
' Turns the string into an array

If AddAdditional = "yes" Then

List2 =
Evaluate("@Trim(@name([Canonicalize];@trim(@unique(@explode(""[Manager]:"" +
""" + FromName + ":" + UserRecipients + """;"":"")))))")
Else

List2 = Evaluate("@Trim(@explode(@Trim(""" + UserRecipients +
""");"":""))")
End If

' The following is where the comparison and replace of the 2 lists begin

Dim newlist As Variant
Dim count As Integer

Redim newlist(0)

Forall i In list1
count = 0
Forall j In list2
If i = j Then
Redim Preserve newlist(count)
newlist(count) = j
count = count + 1
Else
count = count + 1
End If
End Forall
End Forall

'end replace

GetListIntersect = newlist


End Function

Dig Deeper on Domino Resources - Part 4

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close