Writing Data Internally

In addition to output parameters being used by Workflow to perform actions, your form can have output data that is written internally; for example, to a log file, or a Proficy service provider.

The code that writes the data should be inserted into the TransferDataOut() override.

An existing sample form (LoggerFormVB) takes a message from the form and writes it to the standard log file. The code for the override is as follows:

Private ReadOnly Property Logger() As ILog
        Get
            Return LogManager.GetLogger("LoggerForm", LogContextBehavior.UseThreadLogContext)
        End Get
    End Property

    Public Overloads Overrides Sub TransferDataOut()

        ' There are no output paremeters, but we have this override which is called on Submit. 
        ' It will write the logger data to 
        ' Proficy INstall directory\Proficy Workflow\Program\Logs\ProficyClient.log 
        ' Each line will have [Client.LoggerForm] at the end. 
        ' To see the DEBUG ones you have to lower the logging level. 
        Dim gsd As New GetStringDelegate(AddressOf SameString)
        Select Case LoggerType.SelectedIndex
            Case 0
                Logger.Info(gsd, LoggerText.Text)
                Exit Select
            Case 1
                Logger.[Error](gsd, LoggerText.Text)
                Exit Select
            Case 2
                Logger.Debug(LoggerText.Text)
                Exit Select
            Case Else
                Exit Select
        End Select
    End Sub

    ' A simple function returning the same string as was input. 
    Public Function SameString(ByVal input As String, ByVal culture As Globalization.CultureInfo) As String
        Return input
    End Function