Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products

Integra Script Library Documentation


Context:

General

Library/Class:

Sample Code



Insert Excel row on value change of category value in stats.CatStr[] As Integer, Read/Write

Note: since version 4.3 this can be achieved using the CB_CATEGORY event or by looking at the stats.CurCatValue and stats.CurCatLevel property. However, the CB_CATEGORY event as well as the two StaticVars properties are not available for all export scenarios, hence this sample is still very much valid for exports running on selected documents.

One particular useful example how the CatStr[] property can be utilised within the
Callback Script field is, for instance, to insert an extra row into an Excel spreadsheet
whenever the category is changing from one exported Notes document to the next
document one.

The following has to be configured in the Integra profile to make the code example
work:

As the first field in the Selected Field List add a computed (formula) field called
Category and leave the formula set to None. Then add all the other fields that are to be
exported to Excel.


Const CB_INITIALISE = 3
Const CB_ACTIONONLY = 16
Const CB_BFOREXPORT = 10
Const CB_INVALID = 12
Const CB_CATEGORY = 13
Const CB_TOTAL = 14
Const CB_CONFLICT = 15
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_ACTIONONLY
case CB_BFOREXPORT
case CB_INVALID
case CB_CATEGORY
case CB_TOTAL
case CB_CONFLICT
case CB_BFORREADNOTES
case CB_BFORWRITECOM

    Dim InsCat As Integer

    InsCat = False

    If stats.KeyCnt = 0 Then
      InsCat = True
    ElseIf Not stats.CatStr(stats.KeyCnt-1) = stats.CatStr(stats.KeyCnt) Then
      InsCat = True
    End If

    If InsCat Then
      ' this is the first call or the category has changed,
      ' so we need to insert a category row
      ' blank export values
      ForAll itm In export.Record.FValue
        itm = ""
      End ForAll
      ' insert blank row
      Call export.WriteNext(stats)
      ' set category for first column
      export.Record.FValue(0) = stats.Category(stats.KeyCnt)
      ' insert category row
      Call export.WriteNext(stats)
      ' re-read values from Notes document and let Integra continue
      Call export.ReadFromDoc(stats, stats.ExpDoc)
    End If

case CB_AFTERWRITECOM
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
 
QUICK LINKS
 
 

 

  © Shireburn Software Ltd. 2008 - 2024