Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products



How do I filter selected data based on a value entered by the user at RunTime?


When running an Integra for Notes profile, there are times when you wish Integra to pop-up a dialog to allow entry of a value by the user and then only to export data meeting the condition appropriate for that value.

Take as an example the standard Notes R5 personal address book. The person documents in this address book can be categorised using the Categories field. You may wish to create an Integra profile which at runtime requests the user to enter the name of a particular category and for only documents of that category to be exported.

This process involves 2 steps:
  1. the presentation of the appropriate dialog box to the user at runtime into which the name of the required category is to be entered
  2. the filtering of the data in Notes to only export data whose Category field matches the user entered value.


Regarding the presentation of the dialog box, the @Prompt function will not work in such a situation and the solution to be used is the use of the InputBox method in Lotuscript which would be placed in the Advanced Tab of an Integra profile.

Below is an example of the Script Callback code that would be required in the Advanced Tab of an Integra profile to prompt a user to enter a value into an InputBox. Note that the InputBox instruction defines the prompt for the window presented to the user as well as the window title and stores the data in a temporary variable called cat (in our example). The value entered into cat is not validated in this example but could be using further coding to ensure that only an existing category has been selected by the user and providing messages and looping in case of a failure. This would be done using standard LotusScript..

stats is one of Integra's runtime objects derived from the StaticVars object class. It provides global information regarding the import or export process and it also includes the property uservar of type Variant, which can be utilised to store temporary information to be carried forward from event to event (execution of the Script Callback code). It is similar to the use of a variable declared as Static, however this type of declaration is not available for Lotus Script executed at runtime and therefore we have provided this property in which one can store any type of information needed throughout the import or export process.

The code found within the cb_bforwritecom event filters the data being sent to the Com object (Excel or Word).


Const CB_INITIALISE = 3
Const CB_BFORREADNOTES = 6
Const CB_BFORREADCOM = 7
Const CB_BFORWRITECOM = 1
Const CB_BFORWRITENOTES = 8
Const CB_BFORCOMACTION = 5
Const CB_BFORNOTESACTION = 2
Const CB_TERMINATE = 4

select case stats.cbstatus
case CB_INITIALISE
    ' temporarely disable the Integra progress bar
    If stats.pbar.enabled Then
      Call stats.pbar.DisableProgressBar()
      stats.uservar = Inputbox("Enter category to be exported","Contact Export - Category","")
      ' Call stats.pbar.EnableProgressBar() ' Integra for Notes 4.0
      Call stats.pbar.EnableProgressBar(False) ' Integra for Notes 4.1
    else
      stats.uservar = Inputbox("Enter category to be exported","Contact Export - Category","")
    end if
case CB_BFORREADNOTES
case CB_BFORWRITECOM
    tmpvar = stats.expdoc.categories

    if instr(arraytostring(tmpvar,"~") & "~",stats.uservar) = 0 then
      export.continue = false
    end if
case CB_BFORCOMACTION
case CB_BFORNOTESACTION
case CB_TERMINATE
end select


Related FAQ's
How can I include custom dialogs to allow users to enter filter criteria?

.




FAQ# 0050
Bookmark and Share

 
QUICK LINKS
 
 

 

  © Shireburn Software Ltd. 2008 - 2024