Has anyone ever seen ColumnValues NOT return an array when it was supposed to? What were the circumstances?
searchcount = SomeDocVw.FTSearch( searchstring , 0 )
If searchcount = 0 Then Exit Sub
Set SomeDoc = SomeDocVw.GetFirstDocument
columnvalue0 = SomeDoc.ColumnValues( 0 ) ’ Variant does not contain a container
These are 6.5.1 clients on an 8.5.1 server.
Just had a user throw a VDNCAC in code substantially similar to the above code. This dialog form has been used about a 1000 times a week for a few years now, and this is the first time I’ve had this. I’m not aware of any condition that will cause ColuimnValues to not be an array (when ColumnValues is supposed to be available, that is.)
Anyone else see anything like this?
Subject: Yes I have seen it…
I think it’s related to the issues described here:http://www-01.ibm.com/support/docview.wss?uid=swg21396849
Subject: ColumnValues is not always an array
The value returned from ColumnValues is not always an array.
Example on how to code for this:
Dim ColumnValuesVar As Variant
searchcount = SomeDocVw.FTSearch( searchstring , 0 )
If searchcount = 0 Then Exit Sub
Set SomeDoc = SomeDocVw.GetFirstDocument
ColumnValuesVar = SomeDoc.ColumnValues
If IsArray(ColumnValuesVar) Then
columnvalue0 = ColumnValuesVar(0)
Else
columnvalue0 = Cstr(ColumnValuesVar)
End If
We do a lot of data conversion for Lotus Notes / Domino and have known about this since release 5. I’m surprised you haven’t come across this before.
Hope this helps.
Alex
Subject: But what are the conditions that would cause this?
It’s not my practice to code for events that are not supposed to happen. As far as I’m aware, ColumnValues is always supposed to be an array. The help does not describe any other return value.
Casper Andersen’s response makes more sense…that’s it’s an environmental issue. My problem with that is that the error occurred during a time of low load on the server.
If ColumnValues doesn’t return an array when there is some kind of error somewhere, say in a column formula, then that’s a different story. If that’s the case then my solution there is fix the view. I would never write code that allows other problems to persist. That’s a good way to create data integrity problems.
So when is it that the value returned from ColumnValues is not always an array, and is that an expected condition, or unexpected condition?
Subject: further on invalid collections
See also this:https://www-304.ibm.com/support/entdocview.wss?uid=swg1LO49368&myns=swglotus&mynp=OCSSKTMJ&mync=E
What I have done in some of my agents is to trap for error 4678 and in case the code falls in there, I refresh the view and do a resume 0 (effectively retrying the operation). Be aware that sometimes this can cause an infinite loop if you do not use some retry counter to check how many times the error has been caught.
Sometimes it’s better to have the (scheduled) agent error out and let it run again later (which in my case most of the time succeeds).
In my environment these errors have been completely random and were introduced after upgrading from 7.0.3 to 7.0.4.
Subject: Lotus Notes doesn’t always work the way it’s supposed to
Lotus Notes doesn’t always work 100% as it’s documented to work so sometimes we need to code for unexpected situations.
I can’t tell you when or how ColumnValues is an array or not an array.
We develop and distribute commercial Lotus Notes / Domino software globally so we’ve experienced a lot of anomolies with Lotus Notes functionality.
As we cater for a large range of different Notes versions and releases we found the coding method we use for handling column values in views (as previously mentioned) to be the most efficient.
Alex
Subject: True, but that’s no reason to avoid the issue
“As we cater for a large range of different Notes versions and releases we found the coding method we use for handling column values in views (as previously mentioned) to be the most efficient.”
It’s most efficient because it doesn’t crash. But the problem with your coding method is that you treat the non-array value as being valid. In my experience, when ever Notes objects return a non-array value in place for an array it’s an invalid value, usually just an empty string. A perfect example is getting a field value from a document in edit mode while the field in question has invalid data, such as text in a numeric field. LotusScript doesn’t return an array, and that’s how you know you’ve got invalid data in the field.
Are you telling me that you’ve actually received the expected value from ColumnValues when it wasn’t an array? I seriously doubt that. How did it ColumnValues know which column you actually wanted? It can’t!
Thanks for your response, but for me, treating the problem as if it never happened is not the answer.
Subject: I fully agree…
I fully agree with your comments.
My main point is with all the various releases of Notes clients and bug fixes in different releases being used by people around the world we found this the best way to handle the column values issue.
I’m sorry but I don’t recall under what situations columnvalues returns a string instead of any array, or if when we get a string whether it contains a value or not.
If you raise this with IBM it’d be interesting to see what they come back with.
Alex