Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products



How to export data from response documents for multiple parent documents

Data in Notes documents is frequently held in response documents but some additional data related to the response document may also be required to be exported from the response document's parent document. This FAQ explains how this is achieved using Integra for Notes.

Firstly, create a profile linked to the Notes form which is the response documents' form. Select the fields that you want to export from the main and/or response documents. You can use computed fields (type formula) to compute the value of the field depending upon the document being exported.

This is the scenario for exporting response documents for multiple parent documents. I have a Notes database with purchase orders. Each purchase order has a heading document with e.g. details of the supplier and n numbers of line items (stored as Notes response documents). The user selects one or more purchase order header documents and runs Integra to create a well formatted purchase order in Excel.

The requirement here is that though the user selects the parent document(s), Integra should export the response documents. The Callback Script (advanced tab in the Integra profile) code sample below shows how to export the response documents for each parent document processed.

Click here if you want to export the response documents of only one parent document.
Click here for a more generic sample
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
case CB_BFOREXPORT
case CB_BFORREADNOTES
case CB_BFORWRITECOM

if stats.expdoc.hasitem("$Conflict") Then
' don't export conflict documents
export.continue = false
elseif not stats.expdoc.form(0) = "Pack" then
' any condition required if not all response documents are to be exported
' you can remove the elseif construct if you are certain that there are no
' other type of response documents then the ones you want to export
export.continue = false 
end if

' check if main documented has responses and if none exit
if stats.expdoc.responses.count = 0 then
export.continue = false
end if

' Export the main document.  This line can be removed if you only want to export response documents
call export.writenext(stats)

dim tmpcol as notesdocumentcollection
dim tmpdoc as notesdocument

' Store the responses to the current parent document in a temporary document collection
set tmpcol = stats.expdoc.responses
set tmpdoc = tmpcol.getfirstdocument

' Loop through the response documents
do while not tmpdoc is nothing
' any condition required if not all response documents are to be exported
' you can remove the elseif construct if you are certain that there are no
' other type of response documents then the ones you want to export		
if tmpdoc.form(0) = "Service Call" then
'Populate the fields with the values found on the response document to be exported
call export.readfromdoc(stats,tmpdoc)

'Export the response document
call export.writenext(stats)
end if

set tmpdoc = tmpcol.getnextdocument(tmpdoc)
loop

'Set this so that Integra will not export any documents since the above code exports the documents
export.continue = false

case CB_AFTERWRITECOM
case CB_BFORCOMACTION
case CB_BFORNOTESACTION
case CB_TERMINATE
end select

.




FAQ# 0182
Bookmark and Share

 
QUICK LINKS
 
 

 

   Shireburn Software Ltd. 2008 - 2021