How To Avoid LF in source file

Post Reply
User avatar
mce
Community Contributor
Posts: 352
Joined: Tue Jul 20, 2010 5:01 pm
OLAP Product: Cognos TM1
Version: Planning Analytics Local 2.0.x
Excel Version: 2013 2016
Location: Istanbul, Turkey

How To Avoid LF in source file

Post by mce »

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 2876 times
User avatar
qml
MVP
Posts: 1094
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: How To Avoid LF in source file

Post by qml »

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
MVP
Posts: 782
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: How To Avoid LF in source file

Post by macsir »

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