«

»

Multiple Values in a View – Now With More Special

Okay, so in my last (technical) blog post, I noted a problem I had with getting multiple values in a view via LotusScript. I learned and posted that the NotesViewNavigator was the solution.

The wise Nathan Freeman posted a comment, which I think has quite a handy littly tidbit in it, but I fear not enough people read my blog, let alone read the comments on my blog days after a posting, so I am blogging about his comment. With an example and screenshot.

Here is what Nathan said:


“Make a set of documents with several multi-value fields, all text.

Field 1: Red, Green, Blue
Field 2: Me, Myself, I
Field 3: This, That, The Other
Field 4: Apples, Churches, Very Small Rocks

Give them all the same values for Field 1, but randomize the values for fields 2-4

Now create a view that has a column for each of these fields, in order. Set them all to “Show multiple values as separate entries.”

On the first column, turn on categorization.

Now look at your view CLOSELY.

If you want to do something really special, try CreateViewNavigatorFromCategory(“Red”). Then walk the entries and retrieve the .columnValues.

Discuss.”

So, I tried it out. Really special indeed.

Say you had an application with a salesperson form. In this example we have a whopping three documents, but stick with me. We have three fields, “date”, “item” and “quantity”. These three fields are multi-value fields. We’ll assume we have three documents because we only have three salespeople, one for each.

Doc 1:
11/15/09; 11/30/09; 12/15/09; 12/31/09
Apples; Oranges; Grapes; Peaches
10; 30; 40; 20

Doc 2:
11/15/09; 11/30/09; 12/15/09; 12/31/09
Oranges; Apples; Grapes; Peaches
40; 30; 20; 10

Doc 3:
11/15/09; 11/30/09; 12/15/09; 12/31/09
Peaches; Grapes; Apples; Oranges
30; 40; 20; 10

Now if we put these three docs in a view, without “Show multiple values as separate entries”, I would have three rows in my view, with all the data lumped together, separated by semi-colons.

Or I could follow Nathan’s tip and get this:

special.PNG

And then I could use CreateViewNavFromCategory(dateVariable) to get all my column values. Sort of the “GetAllEntriesByKey” version of the NotesViewNavigator, but better. Way better.

*Newbie tip – don’t sort the remaining columns. Notes will screw up the whole “show as multiple values” thing and each sorted column adds rows for each value for each field. Not good.

*Second newbie tip – don’t rely on the view preview in Designer for this type of view. It almost never looks the same in Designer as it does in the client. There is a reason for the “Preview in Notes” button, use it.

  • http://nathan.lotus911.com Nathan T. Freeman

    Third tip: at least in Notes 6, all these columns had to be text. That may be different these days.

  • Richard Shergold

    Kathy. I’m interested in what you say about the view looking different in Designer. I ALWAYS rely on Designer for this. What did the view look like? Happy New Year by the way.

  • http://www.runningnotes.net Kathy Brown

    Richard, at least in my version of Designer, the categories didn’t show AT ALL. I just had rows of data. Other times, I’ve noticed a bit of wonkiness. If I see unexpected results, I always check to see what it looks like in the client. YMMV.

    And thanks, you too! Emoticon