Domino 9 und frühere Versionen > Administration & Userprobleme

@unique in Scipt

(1/3) > >>

Der Hase:
Hallo Experts, gibt es eine Funktion in Script die mir aus einem
Notesitem alle Werte nur einmal ausgibt.
Etwas wie die Formel @Unique wäre toll

Danke

Rob Green:
nimm doch Evaluate für @unique in Script.
Gab dazu letzte haufenweise Beispiele im Entwicklerforum.

Oder:
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

Function Unique(a)
     Dim data List As Integer
     Dim i%, n%
     
     REM test to see if a is an array; if not, return it
     If Not(IsArray(a)) Then
           Unique = a
           Exit Function
     End If

     For i=Lbound(a) To Ubound(a)
          data( Cstr(a(i)) ) = i
     Next
     
     REM This takes the new list and puts it back into an array
     n = 0
     Redim newarray(0 To Ubound(a)-Lbound(a))
     Forall z In data
          newarray(n) = a(z)
          n = n + 1
     End Forall
     Redim Preserve newarray(0 To n-1)
     
     REM This returns the new array
     Unique = newarray
End Function


zu finden in der megageilen Library (such mal nach unqiue):
http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/816d64935ee8842485256c680051b592?OpenDocument

forrest g:
hi,

du kannst @unique über den befehl evaluate in das script einbinden.
such mal im forum nach evaluate.

tschö

Rob Green:
oh, ein Echo  ;D ;D ;D
*nix für ungut*

forrest g:
hallo rob,

da war wohl einer schneller...

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln