I had a view with several columns that had “Show multiple values as separate entries” selected. Obviously, these columns showed fields with … wait for it…multiple values. I chose to “Show multiple values ad separate entries” because I wanted the multiple values shown alone, each in its own row. Crazy talk, huh?
Okay, so the view is set up and displaying exactly as I want it to. For example, five documents, two values in the field, show as ten rows. Perfect.
Elsewhere in the application, I had an agent that I wanted to walk the view and get the values. I know, this is revolutionary stuff, eh?
So the agent went something like this…
dim view as Notesview
set view = db.GetView (“myMultiValueView”)
dim viewcol as NotesViewCollection
set viewcol = view.AllEntries
dim viewEntry as NotesViewEntry
set viewEntry = viewcol.GetFirstEntry()
While Not (viewEntry is Nothing)
myVal = viewEntry.ColumnValues(8)
set viewEntry = viewcol.GetNextEntry(viewEntry)
Wend
Great, right? Except that “myVal” kept returning just the first value of the multivalue field. If there were two values, and consequently two rows, myVal would return the first value twice. Really infuriating when I knew the code was right. This was pretty simple stuff and was NOT working. A quick check of the help files…everything checks out. My view is good. My code is correct. What’s the problem?
Google to the rescue and I found this SPR, which explained that what I was doing was not going to work. But also provided a workaround.
dim view as Notesview
set view = db.GetView (“myMultiValueView”)
dim nav as NotesViewNavigator
set nav = view.CreateViewNav
dim viewEntry as NotesViewEntry
set viewEntry = nav.GetFirst
While Not (viewEntry is Nothing)
myVal = viewEntry.ColumnValues(8)
set viewEntry = nav.GetNext(viewEntry)
Wend
Hooray! Success! It would have been nice if this was documented in the help file, but at the end of the day (almost literally), I found the way to make it work. And, as is frequently the case, I’m blogging this mostly for other people to find the answer if they have this same problem (including my future self).
