I used ArrayAppend()function to combine two or more array lists into an array list. but I need do @unique(an array list) in LS, not in formula. Any idea?
Subject: How can I @unique(two or more array lists) in LS?
See designer help for ArrayUnique function.dgg
Subject: Maybe this will help?
Below is button that demonstrates this concept. The button uses a LotusScript function called “Unique” to perform the same operation that @Unique(list) performs, using the technique described above.
Code for button…
Sub Click(Source As Button)
Dim newitem$, reslist$, ulist As Variant
newitem = “Notes is kewl”
x = 0
REM prompt the user for items for the array till they quit
Do While newitem <> “”
If newitem <> “” Then
Redim Preserve slist(x) As String
REM InputBox[$] ( prompt [ , [ title ] [ , [ default ] [ , xpos , ypos ] ] ] )
newitem = Inputbox$(“Enter another item to add to the list.” & Chr$(10) & “Click Cancel when you are done.”, “Enter Item”, newitem)
slist(x) = newitem
x = x + 1
End If
Loop
REM run the array through the unique function
ulist = Unique(slist)
REM Now set up the result so it can be displayed to the user
Forall u In ulist
reslist = reslist & Chr$(10) & u
End Forall
Msgbox “The unique list is:” & reslist, “Unique Result”
End Sub
Code for function…
Function Unique(a() As String) As Variant
REM Normal Dims
Dim data List As Integer
Dim x List As Integer
REM This takes the string array passed into the variable and assigns it to a list called “data”
For i=0 To Ubound(a)
tag = a(i)
data( tag ) = 1
Next
REM This takes the new list and puts it back into an array
n = 0
Redim newarray(0 To n)
Forall z In data
Redim Preserve newarray(0 To n)
newarray(n) = Listtag(z)
n = n + 1
End Forall
REM This returns the new array
Unique = newarray
End Function