27/10/2009

Columnvaluesindex : is that an undocumented NotesViewColumn property?

I was doing some simple LotusScript developing with my shiny band-new 8.5.1 Lotus Designer:
exporting data from a Notes view to an Excel document, using COM objects (sorry, no Symphony exporting yet...).

All was fine on my pc, until I made a test on a different client Notes running version 8:
that client did not exported any data because of just one error in a script line... But what was the error?!

Turns out that I used a NotesViewColumn property that was not evailable on R8: Columnvaluesindex

Taking a look into R8.5 release Designer help I could not find any info about it...
No info googling the web...

So it turns out that I used a property that is not yet documented but is available through the Designer editor Content Assist ;-) , i.e. what you see when you push the dot key after the object name ( e.g. NotesViewColumn.) and you get all properties and methods of that object.

As far as I know, NotesViewColumn.Columnvaluesindex property is similar to NotesViewColumn.position property: "position" returns an integer number starting from 1 , whilst "Columnvaluesindex" return a long number starting from 0.

I fixed my code simply using the "position" property and subtracting 1 to its return value ;-)

3 comments:

Erik Brooks said...

I'll have to test to be sure, but guessing by the name this sounds to me like it might be the solution for something I've had to hack my way around for a long time.

If a doc appears in multiple rows (the "show multiple values as separate entries" checkbox or whatever it is called) the NotesDocument.ColumnValues and NotesViewEntry.ColumnValues both return ALL column values, all the time.

E.g. if a doc has two entries because a column has "apple":"birthday", then ColumnValues always returns "apple":"birthday", regardless of which actually corresponds to the *row* through which you are accessing the doc.

They probably had to expose this for XPages (since the .rowData property *is* aware.) Maybe this will be opened up in a future version.

GMarckofff said...

Hello,

ColumnValuesIndex return -1 if a column doesn't correspond to any value in entry.columnvalues().
For exemple if a column contain a constant or a formula like @docChildren, ColumnValuesIndex will be -1 so for others cols ColumnValuesIndex will correspond to the index of the column data in entry.columnvalues()

Dmytro Pastovenskyi said...

Erik & GMarckofff thank you for this topic, I was looking for this property and there is only 1 your post about it :)
Now I understand the purpose of this property.