en · de

Notes Fehler: Ansicht nach Feldwerten sortiert - Austausch der Dokumente

by Thomas,
assono GmbH, Standort Kiel,

While developing a Notes application, we discovered a bug with critical consequences under certain circumstances. If you work with documents in a sorted view, it might occur that Notes exchanges an open document with another document. This happens if you switch to read mode, after changing the value of a field which affects the sorting.

A concrete example:
We have two documents in a view. Both documents have a field named "number" which contains a numeric value. The field in the first document has a value of 1, in the second document a value of 2. The documents in the view are sorted by ascending order of the field "number".
pic1.png
You open the first document in edit-mode and change the fieldvalue from 1 to 3.
pic2.png
pic3.png
Then you save the document and switch to read-mode.
pic4.png
Instead of the first document with the value 3, the second document with value 2 is displayed in read-mode.
pic5.png
Why this happens? Because the documents position in the sorted view is modified by the new value, which seems to affect the document that is to be displayed.

We attached a database to this blog post for testing the bug. In the database there are two views (view1, view2). In view1 we have solved the problem already. In view2 you can comprehand the bug with the example.

The following code, we have added to the solution of the problem in view1 in the "Query Mode Change" of the mask of documents:

 Dim uiws As New NotesUIWorkspace 
 Dim doc As NotesDocument 
 Dim docReopen As notesDocument 
 Dim newUIDoc As NotesUIDocument
 Dim item As NotesItem
 Dim unid As String
 Dim msgSave As Integer
 Dim msgReset As Integer
 
 If source.EditMode Then
 If source.ModifiedSinceSaved Then
 msgSave = Messagebox("Do you want to save your changes?, MB_YESNOCANCEL, "IBM Notes")
 If msgSave = IDYES Then
 source.Save
 Elseif msgSave = IDNO Then
 msgReset = Messagebox("Do you want to reset the document?" + Chr$(10) + Chr$(10) + _
 |If "Yes" the document going to reset to last state before saving.| + Chr$(10) + _
 |If "No" the last changes will be displayed unsaved.|, MB_YESNO, "IBM Notes")
 End If
 End If
 If Not msgSave = IDCANCEL Then
 Set doc = source.Document 
 unid = doc.UniversalID 
 Set item = New NotesItem(doc, "SaveOptions", 0) 
 source.Close 
 If msgReset = IDYES Then
 Delete doc
 End If 
 Set docReopen = uiws.CurrentDatabase.Database.GetDocumentByUNID(unid) 
 Set newUIDoc = uiws.EditDocument(False, docReopen)
 Call uiws.ViewRefresh
 End If
 continue = False
 End If

S
zip.gif
FehlerDB.zip
(1127 Kb)

Technical article IBM Notes IBM Notes Traveler

You have questions about this article? Contact us: blog@assono.de

Sie wollen eine individuelle Beratung oder einen Workshop? Read more

More interesting entries

Any questions? Contact us.

If you want to know more about our offers, you can contact us at any time. There are several ways to contact us for a non-binding first consultation.

assono GmbH

Location Kiel (headquarters)
assono GmbH
Lise-Meitner-Straße 1–7
24223 Schwentinental

Location Hamburg
assono GmbH
Bornkampsweg 58
22761 Hamburg

Phone numbers:
Human resources department: +49 4307 900 407
Marketing department: +49 4307 900 411

E-Mail adresses:
contact@assono.de
bewerbung@assono.de