Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products



How to export documents with a multi-value Field into Excel creating one row for each value representing the same document?

The standard way Integra handles multi-value fields is in converting them into a string each value separated by the character(s) as defined in the Integra profile (multi-value separator field found in the Excel tab)and creating a single row in the Excel spreadsheet representing the exported Notes document.

The following code example shows how to export documents containing a multi-value field in such a way that for each of the values in the multi-value field one row in the Excel spreadsheet is created; keeping the same column data for all fields, but exporting the column representing the multi-value field for each row with the corresponding value of the multi-value field.

The code below has to be placed into the Callback Script field in the Advanced tab of the Integra profile. The code example assumes that the multi-value field is the first field listed in the Selected Field List in the Integra profile.

For this example to work correctly, the Show multiple values as separate entries option should not be used for any of the columns in the view. This as Integra for Notes has its standard way of dealing with multi-value field/formula column and this would effect this example code and vice versa.
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
case CB_BFORREADNOTES
case CB_BFORREADCOM
case CB_BFORWRITECOM
Dim mv As Variant

' Stores the value(s) of the first field in the field list
mv = export.record.FValue(0)

' If the above field contains multiple values, these need to be exported as separate rows
If IsArray(mv) Then
' Data for the current document is not to be exported automatically
export.continue = False

' Manually export the multiple values as separate rows
For i = 0 To Ubound(mv)
export.record.FValue(0) = mv(i)
Call export.WriteNext(stats)
Next
End If
case CB_BFORWRITENOTES
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# 0060
Bookmark and Share

 
QUICK LINKS
 
 

 

  © Shireburn Software Ltd. 2008 - 2024