Create txt file with line breaks in TI process

Post Reply
holger_b
Posts: 131
Joined: Tue May 17, 2011 10:04 am
OLAP Product: TM1
Version: Planning Analytics 2.0
Excel Version: 2016
Location: Freiburg, Germany

Create txt file with line breaks in TI process

Post by holger_b »

Dear forum,

did anybody ever manage to write a .txt file with line breaks in TI? The background of this is, I currently create a status email message which is properly formatted, and I would like to simply store the same text in a flat log file, but asciioutput keeps swallowing the line breaks. I tried it with CHAR(10), CHAR(13) and \n, no success. I also tried ExecuteCommand('cmd /c echo ' | sMessage | ' > filename.txt', 1), but no avail.

I know I could do this with a series of asciioutput commands, but I would much prefer a nicer way... Any hints?

Thank you
Holger
lotsaram
MVP
Posts: 3706
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Create txt file with line breaks in TI process

Post by lotsaram »

holger_b wrote:I know I could do this with a series of asciioutput commands, but I would much prefer a nicer way... Any hints?
Multiple ASCIIOutput. 1 ASCIIOUtput = 1 line.
holger_b
Posts: 131
Joined: Tue May 17, 2011 10:04 am
OLAP Product: TM1
Version: Planning Analytics 2.0
Excel Version: 2016
Location: Freiburg, Germany

Re: Create txt file with line breaks in TI process

Post by holger_b »

Thanks you lotsaram. I did it like this:

Code: Select all

DataSourceASCIIQuoteCharacter = '';
sOutputMsg = sMessage;
nNextLF = SCAN(LF,sOutputMsg);

while( nNextLF > 0 );
   sThisLine = subst( sOutputMsg, 1, nNextLF - 1 );
   asciioutput( sys_log, sThisLine );
   sOutputMsg = subst( sOutputMsg, nNextLF + 1, long( sOutputMsg ));
   nNextLF = SCAN(LF,sOutputMsg);
end;
LF is CHAR(10) btw.

Regards
Holger
Post Reply