|
Reporting from Live & Archive database
Many Lotus Notes applications host their data split across two databases, one being the live data and the other containing the archived data. An examples may be a help desk application where your current month's tickets are maintained in the live database and a process moves closed tickets to the archive on a scheduled basis. In the Lotus Notes environment, this generates significant problems and sometimes forces organisations to maintain all their data in the current database due to their reporting limitations.
Integra for Notes solves even this problem. By using the Script Callback functionality available in the Integra profile's Advanced tab, following the generation of the data from the current database, control can be seemlessly passed over to a pre-defined archive database where reporting will continue from the archive.
The code below is an example of continuation to a database called apps\archive\file001.nsf. Of course you will need to replace the reference to the file name in the example below with your own filename (see comment in red below). In addition, the line srvnm = stats.srcdb.Server will generate the current server but if the archive database is on a different server, replace this line with the server name in quotes.
Of course, this technique assumes that the fields being reported on are available in both the current and the archive database.
This code is applicable for Integra for Notes version 4.1.44 onwards.
Const CB_INITIALISE = 3
Const CB_BFOREXPORT = 10
Const CB_BFORREADNOTES = 6
Const CB_BFORWRITECOM = 1
Const CB_AFTERWRITECOM = 9
Const CB_BFORCOMACTION = 5
Const CB_BFORNOTESACTION = 2
Const CB_TERMINATE = 4
select case stats.cbstatus
case CB_INITIALISE
stats.uservar = "0"
case CB_BFOREXPORT
case CB_BFORREADNOTES
case CB_BFORWRITECOM
case CB_AFTERWRITECOM
dim srvnm as string
dim dbnm as string
dim vwnm as string
if stats.keycnt = (stats.keynum - 1) and stats.uservar = "0" then
stats.uservar = "1"
srvnm = stats.srcdb.Server ' replace with your server unless current server is fine
dbnm = "apps\archive\file001.nsf" ' replace with your filename
vwnm = stats.view.name
set stats.srcdb = session.GetDatabase(srvnm,dbnm,false)
set stats.view = stats.srcdb.GetView(vwnm)
set stats.entrycol = stats.view.AllEntries
set stats.ViewNav = stats.View.CreateViewNav()
set stats.Entry = stats.entrycol.getfirstentry
set stats.expdoc = stats.entry.Document
stats.keynum = stats.keynum + stats.entrycol.count
stats.lstcall = false
stats.procstat = 2
end if
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
|
. |