Page 1 of 1

ASCIIOutput or TextOutput without Line Feed/Carrige Return

Posted: Fri May 14, 2010 9:07 pm
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!!

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Posted: Sat May 15, 2010 12:27 pm
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

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Posted: Sat May 15, 2010 9:18 pm
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?

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Posted: Sun May 16, 2010 9:53 pm
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.

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Posted: Tue May 18, 2010 4:24 am
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);

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Posted: Tue May 18, 2010 4:51 am
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.

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Posted: Tue May 18, 2010 5:05 am
by olapuser
Alan,

You're right, this is odd.

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Posted: Tue May 18, 2010 6:40 pm
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

Re: ASCIIOutput or TextOutput without Line Feed/Carrige Retu

Posted: Wed May 19, 2010 7:44 am
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