At the marvelous Engage conference I had the honor to speak about "How to get my app on mobile?". Between the obvious choices of having a … more
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".
You open the first document in edit-mode and change the fieldvalue from 1 to 3.
Then you save the document and switch to read-mode.
Instead of the first document with the value 3, the second document with value 2 is displayed in read-mode.
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
Sie haben Fragen zu diesem Artikel? Kontaktieren Sie uns gerne: firstname.lastname@example.org
"Drive your dreams" - is the motto of this year's international Engange conference, which will take place in Brussels for three days ... more
9,6% market share and 18% market growth for IBM in the AI sector in 2017 – that is the impressive result of a study … more