Showing results for 
Search instead for 
Did you mean: 
Community Manager
Community Manager
'Reference Code:  XFR_GetFilenameForSourceID 
'Description:     Gets the file name being processed, strips off the unique indentifier that XF
'                 adds to the file name and returns the origninal source file name.
'Usage:           Parser business rule intended to be used on the SourceID field in a data source.
'Created By:      OneStream Software
'Date Created:    06-01-2016
'Get the filename and strip off the Unique ID suffix if it exists
If api.Parser.Transformer.FileInfo.SourceFileName.Contains("_") Then
    'Split filename into segments (Parse by "_" character)
    Dim segments As List(Of String) = StringHelper.SplitString(api.Parser.Transformer.FileInfo.SourceFileName, "_", StageConstants.ParserDefaults.DefaultQuoteCharacter)
    'Create a string builder object and then loop over the segments and put the file name back together 
    'but skip the last segment which is the Unique ID suffix.  We use a string builder rather than concatenating
    'with the "&" because string builders are much faster.
    Dim segName As New System.Text.StringBuilder 
    For seg As Integer = 0 To segments.Count - 2
        If seg < (segments.Count-2) Then segName.Append("_")
    'Return the contents of the string builder as a string
    Return segName.ToString    
    'File name does not contain "_" just return it
    Return api.Parser.Transformer.FileInfo.SourceFileName
End If
Version history
Last update:
‎03-08-2022 08:33 AM
Updated by: