Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products



How can I export multi-value categorised documents for only selected categories?

The following advanced code example can be used to export selected categories from a categorised view. The code works on selected documents as well as for all documents in the view.

The code will check whether the view has any categories and if so it will present a dialog showing the list of available categories (categories in which documents have been selected). By default no category is selected, however, if the user will confirm the dialog not selecting any of the categories listed, all categories will be exported.
THIS CODE REQUIRES INTEGRA FOR NOTES 4.1 BUILD 9 +

THIS CODE DOES NOT WORK WITH INTEGRA FOR NOTES 4.2

NOTE: Do not place any of the following code into the CustomCode script library of the Integra database in an attempt to optimize performance. This as the code contains the use of UI functionality which when included into the CustomCode library will cause Integra's scheduled profile functionality to fail.
Const CB_INITIALISE= 3
Const CB_BFOREXPORT= 10
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
case CB_BFOREXPORT
dim ent   as NotesViewEntry
dim nav   as NotesViewNavigator
dim doc   as NotesDocument
dim catno as integer
dim x     as integer

redim stats.uservar(0)

catno = -1

set stats.viewnav = stats.view.CreateViewNav()

set ent = stats.viewnav.getfirst

if ent is nothing then
call MessageDialog("This export runs only on categorised views.",0,"")

export.continue = false

elseif not ent.iscategory then
call MessageDialog("This export runs only on categorised views.",0,"")

export.continue = false

else
do while not ent is nothing
if ent.indentlevel = 0 then
forall cv in ent.columnvalues
if not typename(cv) = "DOUBLE" then
catno = catno + 1

redim preserve stats.uservar(catno)

stats.uservar(catno) = cv

exit forall
end if
end forall
end if 

set ent = stats.viewnav.getnextcategory(ent) 
loop
 end if

if not isarray(stats.uservar) then
' only one or no categories available, hence take all
stats.uservar = "ALL"
elseif ubound(stats.uservar) = 0 then 
' only one category available, hence take all
stats.uservar = "ALL"
else 
dim ws as new notesuiworkspace

Call stats.pbar.DisableProgressBar()

stats.uservar = ws.Prompt(7,"View export category selection", _
"Select one or more categories you would like to print " + _
"(None = ALL)",stats.uservar(0),stats.uservar)

Call stats.pbar.EnableProgressBar(false)

if isarray(stats.uservar) then
if stats.uservar(0) = "" then
export.continue = false
end if
elseif stats.uservar = "" then 
export.continue = false
end if

if export.continue then
set stats.doccol = _
stats.view.getalldocumentsbykey("{DefinitelyNotThereThisEntry}",True)

forall cat in stats.uservar
set nav = stats.view.CreateViewNavFromCategory(cat)
set ent = nav.getfirstdocument()
  
do while not ent is nothing
if ent.isdocument then
set doc = stats.doccol.getdocument(ent.document)

if doc is nothing then
call stats.doccol.adddocument(ent.document)
end if
end if

set ent = nav.getnextdocument(ent)
loop
end forall
end if
end if

if stats.doccol.count = 0 then
export.continue = false
end if

case CB_BFORREADNOTES
case CB_BFORWRITECOM 
case CB_BFORCOMACTION
case CB_BFORNOTESACTION 
if not stats.savdoc is nothing then
' before save as...
else 
' before send to
end if
case CB_TERMINATE
end select

.




FAQ# 0040
Bookmark and Share

 
QUICK LINKS
 
 

 

  © Shireburn Software Ltd. 2008 - 2024