cancel
Showing results for 
Search instead for 
Did you mean: 

Anyway to account for hard carriage return in a data load file?

MikeKral
New Contributor

SOURCE: ONESTREAM CHAMPIONS

Company has a hard carriage return in their file for a couple of description fields. They are struggling to fix it on their side. Is there code that can be written for the data source to remove this hard return and get everything on one line? Appreciate any guidance or snippet of cod

4 REPLIES 4

I don’t think you can. When the file comes in the column you are trying to fix is already in the second line. This needs to be done at the source. I cannot think of a different way to solve it.

Thanks Celvin! I tend to agree as that it is what I see when I look at the data in Notepad++ The line is already showing up in 3 separate lines within the data file. I will push back on the and try and get them to resolve on their side or determine that this field is not critical to bring into stage. Thanks, Mike

AndyR
New Contributor III

I had a similar problem at one point and had to remove a significant number of special characters (not all shown here). Try this in a Parser BR (sorry the tabs are not pasting in correctly):

Namespace OneStream.BusinessRule.Parser.Parse_Remove_Special_Characters
Public Class MainClass
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As ParserDimension, ByVal args As ParserArgs) As Object
Try

  		If args.Value = "" Then
  			Return "Empty_String"
  			Else

  				Return args.Value.Replace(vbCr, "").Replace(vbLf, "")
  		
  		End If	

  	Catch ex As Exception
  		Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
  	End Try	
  End Function

End Class
End Namespace

For the sake of anyone else that might read this later, you then attach this Business Rule to the dimension in the Data Source that you’re having issues with by selecting it as the Logical Operator/Expression.

MikeKral
New Contributor

Thanks for the suggestion Andy! I will give it a try and let you the group know.