Manage Learn to apply best practices and optimize your operations.

Create unique list of view column values

Recently we had to create a report routine that dynamically categorised entries according to values shown in a view. This script traverses the view and adds new entries to a string array for further processing if they are 'new'. Report processing occurs witin the final forall statement that for now is just abbreviated as a message box display of the arrays values.


 Sub Initialize ' instantiate and populate required objects Dim session As New NotesSession Dim db As notesDatabase Set db = session.currentDatabase Dim view As NotesView Set view = db.getView("Test") ' replace this string with the name of
the view you require Dim catArray() As String Dim vColl As NotesViewEntryCollection Set vColl = view.allEntries Dim entry As NotesViewEntry Set entry = vColl.getFirstEntry Dim i As Integer i = 0 While Not entry Is Nothing ' recurses through vColl whilst there is an entry available Dim inList As Variant inList = False ' reset to false for each new value of entry column Dim colVal As String colVal = entry.columnValues(0) ' test the current value and set flag inList to true if found already Forall n In catArray If colVal = n Then inList = True End If End Forall ' if the value is false it is logically not in the list so increase size of the array and ' add the new value If inList = False Then Redim Preserve catArray(i) As String catArray(i) = colVal i = i +1 End If Set entry = vColl.getNextEntry(entry) Wend ' once you have the string array you can process the report entries within a
forall statement Forall v In catArray Msgbox(v) End Forall End Sub

Dig Deeper on Domino Resources - Part 3

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close