Article Details
| Id: | 11666 |
| Product: | finPOWER Connect |
| Type: | FIX |
| Version: | 2.00.02 |
| Opened: | 13/01/2014 |
| Closed: | 20/01/2014 |
| Released: | 05/02/2014 |
| Job: | J012723 |
Documents; Script type Documents do not retain the value of the 'Supports Batch Print' option
Script type Documents do not retain the value of the 'Supports Batch Print' option when saved.
This is necessary when using a Script type Document to generate an export file, e.g., to send to a publishing house.
The following sample Document Script will generate a made-up file format using the Script's 'Publish' event:
Public Function Main(source As Object, eventId As String, eventArgs As ISKeyValueList, ByRef handled As Boolean, parameters As Object, ByRef returnValues As ISKeyValueList, ByRef text As String) As BooleanDim FileWriter As ISFileWriterDim LogPublishBatch As finLogPublishBatchDim LogPublishBatchItem As finLogPublishBatchItem' Assume SuccessMain = True' Handle EventsSelect Case eventIdCase "Publish"' Script Document is being published. If this is an Ad-Hoc publish then source will be Nothing otherwise it will be a finLogPublishBatch objectLogPublishBatch = DirectCast(source, finLogPublishBatch)' Write HeaderFileWriter = finBL.Runtime.CreateFileWriter()If FileWriter.Open("c:\docbatch.txt", False) ThenFileWriter.WriteLine("#Header: " & LogPublishBatch.Count & " items")ElseMain = FalseEnd If' Write LinesIf Main ThenFor Each LogPublishBatchItem In LogPublishBatchIf FileWriter.WriteLine(String.Format("{0}|{1}|{2}", LogPublishBatchItem.DocumentId, LogPublishBatchItem.Id, LogPublishBatchItem.Name)) Then' SuccessLogPublishBatchItem.PublishSuccess = TrueLogPublishBatchItem.PublishDocumentFileName = "c:\docbatch.txt"Else' FailureMain = FalseLogPublishBatchItem.PublishError = finBL.Error.Message(True, True)Exit ForEnd IfNextEnd If' Write FooterIf Main ThenMain = FileWriter.WriteLine("#Footer")End If' FinaliseIf FileWriter.IsOpen Then FileWriter.Close()End SelectEnd Function