How To Avoid LF in source file

Post Reply
User avatar
mce
Community Contributor
Posts: 266
Joined: Tue Jul 20, 2010 5:01 pm
OLAP Product: Cognos TM1
Version: TM1 10.2
Excel Version: 2010 2013
Location: Istanbul, Turkey

How To Avoid LF in source file

Post by mce » Wed Jan 03, 2018 3:42 pm

Hi,

I am trying to load data from a text file, but text file has LF characters randomly in many places within the text.
TI is treating those LF characters as line breaks, although there should not be line breaks in those places.
I need TI avoid those LF characters. How can achive this? Any ideas?

Thanks in advance for all replies...
LF_issue.JPG
LF_issue.JPG (60.01 KiB) Viewed 445 times

User avatar
qml
MVP
Posts: 1054
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: How To Avoid LF in source file

Post by qml » Wed Jan 03, 2018 4:43 pm

I think you'll have to do some sort of pre-processing of the file to remove the unwanted LF characters. You can do it directly in TI (if you have a way of recognising where the genuine new lines should be - e.g. any LF within a string enclosed in double quotes would be a candidate for removal), but it is way simpler and more elegant to write an external script (e.g. Perl or Python) to deal with the problem before you feed fixed files to TI.

As far as I know there is no way to tell TI which character is used as record separator - most typical newline characters (\r, \f, \n and some combinations thereof) will be recognised as the end of a data record.
Kamil Arendt

User avatar
macsir
Community Contributor
Posts: 514
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1, SSAS
Version: 9.5 - 10.2
Excel Version: 97 - 2013
Contact:

Re: How To Avoid LF in source file

Post by macsir » Thu Jan 04, 2018 7:42 am

Yes, Perl can deal with these characters pretty easy.
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/

Post Reply