1

As per the documentation for Lotus Notes, a view that contains a column with a constant value or UI only function as its data, the column will not be included in the vector of column values via the getColumnValues method of a view entry. So, if you have 5 columns defined in the view, and one column is a constant value, then the view entry only returns a vector of 4 column values.

As much as this is understandable from a view index efficiency POV, it unfortunately presents developers with a significant dilemma in analysing the meta structure of views and its data.

IBM has failed (for years?) to provide a method to allow developers to interrogate the viewColumns structure in order to determine which column will be missing in the vector of columnvalues. Is there any programmatic means to determine which column would be omitted from the getColumnValues method of the viewentry object?

angryITguy
  • 9,332
  • 8
  • 54
  • 82

2 Answers2

1

You can trick the view into treating a constant value in a column as a formula instead. I believe it is as simple as appending an empty string or by wrapping it in an @Text formula. For example:

"Constant Value"  // won't be returned by NotesViewEntry's getColumnValues() method

@Text("Constant Value")  // should be returned

"Constant Value" + ""  // should also be returned

If that's not an option, you can get access to the columns themselves via the NotesView class. You should be able to compare what you get back for column values to what actual columns exist. That should tell you which ones are omitted, by comparing what columns have no value to the list of columns that exist on the view.

Alternately you could inspect the columns themselves to see which have a constant formula or are the types that are "ui-only". Unfortunately there's no better way than this, I believe.

Ken Pespisa
  • 21,989
  • 3
  • 55
  • 63
  • Thanks ken, but I am not able to "trick" the views, as I have to use them "as-is". I don't quite understand how you can go via the NotesView class to identify which column values would be included (or excluded). Everything seems to point to the ViewColumn class via getColumns from the View class which doesn't offer any methods to do this. Ideally, I need a robust way to determine programmatically which column is omitted, if any. I think I will be forced to manually define it. – angryITguy Jun 12 '12 at 15:44
  • @giulio, I updated my answer - I had things mixed up a bit originally. – Ken Pespisa Jun 12 '12 at 16:18
  • Thanks ken. I think you've confirmed though that IBM have not provided an API for this since it's introduction, (R6.5 ?). I was hoping for someone to provide some means of interrogating the column metadata and actually determining if it's a constant value. There are too many ways for a value to be constant :( – angryITguy Jun 17 '12 at 07:31
1

Use NotesView.getColumns, and then NotesViewColumn.isFormula(), isHidden() and isField() to determine what columns are shown and what their values are. Be very careful when you try to determine that a column has a fixed value...

D.Bugger
  • 2,300
  • 15
  • 19
  • Sorry.. This doesn't address the question at all. -1 – angryITguy Jun 17 '12 at 07:30
  • "a method to allow developers to interrogate the viewColumns structure in order to determine which column will be missing in the vector of columnvalues." It might not be a nice method, but seems a workable workaround to me. – Jasper Duizendstra Jul 04 '12 at 12:13
  • A crude method to find out if a column formula has a fixed value: try { var value= session.evaluate(column.getFormula()); var isFixed= value[0]? true: false; } catch(e) { value= null; isFixed= false; } – D.Bugger Jul 04 '12 at 12:43
  • 1
    For those who bump into the same problem, there is now a new method in R9: isConstant() – D.Bugger Aug 15 '18 at 22:23