Recently I had a requirement form a user where he needs to select a specific set of category documents and export the same into a text file where he can't do the same with Ctrl + A which selects all the documents in the view. The challenge here is the view itself consists of thousands of documents in each category.  For selecting all the documents in a specific category he has to spend considerable amount of time. Basically it is time consuming operation for him.  
In the lotus notes I couldn't find a short cut key for selecting a specific set of category documents. For this I developed a small tool where by using this we can filter all the documents except that specific ones. So  now  the view shows only the required set of category documents, now  these documents can only be selected by using Ctrl + A.
To do this basically i put a action button in the view by clicking on this it populates all the category values  in a dialog box, where the user can select the desired category.  By doing this now the view only shows the selected category documents.

 Once the selection is made from the dialog box now the view displays on the documents specific to that category as shown in  the below picture 

The code  behind the action button :
Sub Click(Source As Button)
 Dim ws As New NotesUIWorkspace
 Dim UiView As NotesUIView
 Dim vw As NotesView
 Set UiView = ws.CurrentView
 Set vw = UiView.View
'Get Handle to the current View and return the all the unuque values in the first column
 Dim Values  
 Values=Evaluate({@unique(@DbColumn ( "" : "" ;"":"" ; "ClientsInMac" ; 1))})
 Redim valueArray(Ubound(Values)+1) As String
 Dim i As Integer
 i=0
 Forall x In values
  valueArray(i)=x
  i=i+1
 End Forall
 valueArray(i)="Return to normal view"
 Values=valueArray
 Dim selectedValue As Variant
selectedValue = ws.Prompt (PROMPT_OKCANCELCOMBO, "Category Selection","Select a Category", Values(0), Values)
 If Isempty (selectedValue) Then
  Exit Sub
 End If
 Dim formula As String
 formula={SELECT form = "ACISClientEntry" & aaaHasMacEntry=-1}
 If selectedValue="Return to normal view" Then
  vw.SelectionFormula=formula
  vw.Refresh
  Call ws.ViewRebuild
  Exit Sub
 End If
 formula=vw.SelectionFormula+ { & @TimeToTextInZone(@Date(@Modified);S0) = "} +selectedValue + {"}
 'Chane the selection formula of the view dynamically based on the current selection.
 vw.SelectionFormula=formula
 vw.Refresh
 Call ws.ViewRebuild
End Sub
 
No comments:
Post a Comment