ASCIIOutput or TextOutput without Line Feed/Carrige Return

Post Reply
ExApplix
Posts: 103
Joined: Mon Sep 21, 2009 7:09 pm
OLAP Product: Cognos Tm1
Version: 10.2.2
Excel Version: 2016

ASCIIOutput or TextOutput without Line Feed/Carrige Return

Post by ExApplix »

I am using ASCIIOut to write to a text file. The file which I get looks like:
Record1
Record2
Record3
.....
But my required outfile should NOT have any 'Line Feed' or 'Carrige Return' etc. and my output file should look like:
Record1Record2Record3.....
Is there a way in TM1 by which I can achieve that?

Please help!!
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: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Post by lotsaram »

This seems like an odd requirement, why would you need to do this?

To your issue as stated:
You can alter the ASCIIOutput delimiter but not the line feed as far as I am aware.

There are two relatively easy workarounds I can think of.
1/ Keep the output text file as is and use vbscript or similar to read the records into a single line as required.
2/ CellPutS your items to a cube cell value on your data tab then just do a single ASCIIOutput on the Epilog
ExApplix
Posts: 103
Joined: Mon Sep 21, 2009 7:09 pm
OLAP Product: Cognos Tm1
Version: 10.2.2
Excel Version: 2016

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Post by ExApplix »

This is the requirement of the ERP system into which I want to load the data from the TM1 cubes. The text file should not have a line feed.

The text file will have thousands (could be millions) of rows of data (imported from the cube), so I think putting all the data into one single cell will not be possible.

Any ideas how can I do that?
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: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Post by lotsaram »

I presume you will still need some kind of field delimiter? (Otherwise how does the ERP interpret a string of potentially millions of characters?)

If you're not talking just a few records but potentially a very large number then go with my 1st suggestion. Use some vb script to read through the output file and modify it by stripping out the line feed characters.

Shouldn't be to difficult.
olapuser
Posts: 40
Joined: Fri Jan 29, 2010 1:55 am
OLAP Product: Cognos TM1
Version: 9.5
Excel Version: 2007
Contact:

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Post by olapuser »

ExApplix,

Simple TI can do that

Code: Select all

# Prolog
DatasourceASCIIQuoteCharacter='';
DatasourceASCIIDelimiter='';

Record = '';

# Metadata
Record = Record | <Cube data / elements / something>;

# Data

# Epilog
ASCIIOutput('SAP.txt', Record);
Alan Kirk
Site Admin
Posts: 6667
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Post by Alan Kirk »

olapuser wrote:ExApplix,

Simple TI can do that

Code: Select all

# Prolog
DatasourceASCIIQuoteCharacter='';
DatasourceASCIIDelimiter='';

Record = '';

# Metadata
Record = Record | <Cube data / elements / something>;

# Data

# Epilog
ASCIIOutput('SAP.txt', Record);
There are a few issues with that.

The first is that it was one of Lotsaram's initial suggestions. The second was ExApplix's statement that the file could run to potentially millions of rows of data. The third, and most crucial, is that there's an undocumented restriction in long strings post 9.4. My tests in 9.5 show that AsciiOutput will output a maximum of 7,999 characters. Beyond that, what you'll get is a message that the process has completed successfully and an empty text file. (Though it's probably undocumented because Iboglix couldn't conceive of someone outputting a string of that length.)

Lotsa's suggestion of using a post-generation script is really the only way to do this.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
olapuser
Posts: 40
Joined: Fri Jan 29, 2010 1:55 am
OLAP Product: Cognos TM1
Version: 9.5
Excel Version: 2007
Contact:

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Post by olapuser »

Alan,

You're right, this is odd.
Wim Gielis
MVP
Posts: 3241
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Post by Wim Gielis »

Alan Kirk wrote:Lotsa's suggestion of using a post-generation script is really the only way to do this.
True.

Just use an easy VBS or VBA routine to convert the output generated by TI.

Shouldn't be so hard to do, it you'd want some assistance with it, I am happy to look at it.

You could have TI execute the code ;)

Wim
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
User avatar
Michel Zijlema
Site Admin
Posts: 713
Joined: Wed May 14, 2008 5:22 am
OLAP Product: TM1, PALO
Version: both 2.5 and higher
Excel Version: 2003-2007-2010
Location: Netherlands
Contact:

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Post by Michel Zijlema »

Hi,

If you're accustomed to a C like language, you can use AWK for this. AWK is a very powerful and fast datastream processing language. I've used this in several projects for datafile pre- or postprocessing.

Michel
Post Reply