<?xml version="1.0" encoding="utf-8"?><finScript version="1.00" exportedUtcDate="2014-10-06T21:34:03.0000000"><CreatedUtcDate>2009-05-13T23:36:22.9680000</CreatedUtcDate><CreatedUserId>Admin</CreatedUserId><UpdatedUtcDate>2014-10-06T21:32:58.0000000</UpdatedUtcDate><UpdatedUserId>Admin</UpdatedUserId><ScriptId>BANKEXPORT</ScriptId><Description>Custom Bank Export</Description><ScriptType>ObjectEvents</ScriptType><Active>true</Active><AllowUI>false</AllowUI><Category /><Code>Option Explicit On

Public Function Main(ByVal eventId As String, ByRef eventHandled As Boolean, ByVal source As Object, ByVal sourceIndex As Integer, ByVal contextData1 As Object, ByVal contextData2 As Object, ByVal parameters As Object) As Boolean

  ' Parameters:
  '   eventId - The event to process
  '   eventHandled - Used to indicate that an event was handled by this Script so normal processing should be ignored (only applies to certain events)
  '   source - The Source object
  '   sourceIndex - The Source object's index, if applicable
  '   contextData1 - Context specific data
  '   contextData2 - Context specific data
  '   parameters - Other values passed to the Script

  Dim BankExport As finBankExport
  Dim BankExportLine As ISBankExportLine
  Dim Export As ISFileWriter
  Dim strTemp As String

  ' Assume Success
  Main = True

  ' Initialise
  BankExport = DirectCast(source, finBankExport)

  ' Handle Events
  Select Case eventId
    Case "ExportOpen"
      ' The Export is being opened. Only applicable to custom exports.

      ' Create Exporter and open the file
      Export = finBL.Runtime.CreateFileWriter
      If Export.Open(BankExport.FileName) Then
        ' Write Custom Header
        Main = Export.WriteLine("CustomHeader")

        ' Save Exporter to Tag property of Bank Export so we can re-use it in ExportLine and ExportClose events
        BankExport.Tag = Export
      Else
        Main = False
      End If

    Case "ExportLine"
      ' A line is being exported. This can be modified if required.
      BankExportLine = DirectCast(contextData1, ISBankExportLine)

      ' Modify Line
      BankExportLine.Reference = "MODIFIED"

      ' Write Custom Line
      Select Case BankExport.ExportType
        Case iseBankExportServiceType.CustomDirect, iseBankExportServiceType.CustomFile
          ' Get Exporter from Tag property
          Export = DirectCast(BankExport.Tag, ISFileWriter)

          ' Build Custom line
          strTemp = finBL.Runtime.TextUtilities.CsvAppend("", "CustomLine")
          strTemp = finBL.Runtime.TextUtilities.CsvAppend(strTemp, BankExportLine.AccountNumber)
          strTemp = finBL.Runtime.TextUtilities.CsvAppend(strTemp, BankExportLine.AccountName)
          strTemp = finBL.Runtime.TextUtilities.CsvAppend(strTemp, Format(BankExport.DateTransfer, "yyyyMMdd"))
          strTemp = finBL.Runtime.TextUtilities.CsvAppend(strTemp, BankExportLine.Reference)
          strTemp = finBL.Runtime.TextUtilities.CsvAppend(strTemp, Format(BankExportLine.Value, "#########0.00"))

          ' Write Custom Line
          Main = Export.WriteLine(strtemp)

      End Select

    Case "ExportClose"
      ' The Export is being closed. Only applicable to custom exports.

      ' Get Exporter from Tag property
      Export = DirectCast(BankExport.Tag, ISFileWriter)

      ' Write Custom Footer
      Main = Export.WriteLine("CustomFooter")

      ' Close
      If Main Then
        Main = Export.Close()
      Else
        ' Must close anyway
        Export.Close()
      End If

    Case "ExportCancel"
      ' The Export is being cancelled, use to close open files etc. Only applicable to custom exports.

      ' Get Exporter from Tag property
      Export = DirectCast(BankExport.Tag, ISFileWriter)

      ' Close
      Main = Export.Close()

  End Select

End Function</Code><Language>VisualBasic</Language><Notes>Custom Direct Debit Export example.</Notes><PermissionKeyExecute /><RunWithoutPrompts>false</RunWithoutPrompts><TimeoutSeconds>60</TimeoutSeconds><RunAsAdministrator>false</RunAsAdministrator><TargetObjectType>BankExport</TargetObjectType><ParametersType>None</ParametersType></finScript>