asciioutput()
- Chengooi
- Posts: 64
- Joined: Tue Jan 13, 2009 7:46 am
- OLAP Product: TM1
- Version: 9.4
- Excel Version: 2003
- Location: Auckland, New Zealand
- Contact:
asciioutput()
Will anyone has a sample TI using asciioutput on a cube view?
The one in TI Help wasn't helpful to me.
I have a view made up and try to export the data of the view to a ascii file, all I get was a cma file with the value as header and no data to it.
I wonder what was wrong.
The one in TI Help wasn't helpful to me.
I have a view made up and try to export the data of the view to a ascii file, all I get was a cma file with the value as header and no data to it.
I wonder what was wrong.
The most wasted of all days is one without laughter.
e e cummings (1894-1962)
e e cummings (1894-1962)
- Alan Kirk
- Site Admin
- Posts: 6606
- 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()
Is it possible that you weren't doing the ASCIIOutput in either the Metadata or the Data tab, and were instead doing it in either the Prolog or the Epilog?Chengooi wrote:Will anyone has a sample TI using asciioutput on a cube view?
The one in TI Help wasn't helpful to me.
I have a view made up and try to export the data of the view to a ascii file, all I get was a cma file with the value as header and no data to it.
I wonder what was wrong.
Do you think it might be useful for us to see the code that you were using to do the output?
"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.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
- Chengooi
- Posts: 64
- Joined: Tue Jan 13, 2009 7:46 am
- OLAP Product: TM1
- Version: 9.4
- Excel Version: 2003
- Location: Auckland, New Zealand
- Contact:
Re: asciioutput()
ASCIIOutput('PhilH.cma', 'CostCentre','Consol','Actual','MTD','period');
yes, only in prolog, never touch the other because don't know how to use it.
I have attached my pro file to your email.
yes, only in prolog, never touch the other because don't know how to use it.
I have attached my pro file to your email.
The most wasted of all days is one without laughter.
e e cummings (1894-1962)
e e cummings (1894-1962)
- Alan Kirk
- Site Admin
- Posts: 6606
- 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()
First, the Prolog is executed only once, before even a single row of the data source is processed.Chengooi wrote:ASCIIOutput('PhilH.cma', 'CostCentre','Consol','Actual','MTD','period');
yes, only in prolog, never touch the other because don't know how to use it.
I have attached my pro file to your email.
Consequently, you can't expect it to output the data from your view. By putting the AsciiOutput in the Prolog tab, it never sees the data. Not one single record of it.
The Metadata and Data tabs both loop through the records which are returned from the data source, one row at a time. It is only in one of those tabs (more commonly the Data one) that you will be able to output the data from your data source using AsciiOutput.
Second, you have put quote marks around each of the arguments in the AsciiOutput function. That means that instead of outputting the variable values from your data source (that is, the contents of each field on each row), you are outputting the field names as literal strings.
That is to say, even if you were to move the code into the Data tab, you'd end up with a file which would read:
"CostCentre","Consol","Actual","MTD","period"
"CostCentre","Consol","Actual","MTD","period"
"CostCentre","Consol","Actual","MTD","period"
"CostCentre","Consol","Actual","MTD","period"
for as many rows of data as you have.
You would need to remove the quotes around the field names if you wanted to output the data rather than the field names (but NOT the file name):
ASCIIOutput('PhilH.cma', CostCentre,Consol,Actual,MTD,period);
That would presuppose that all of the fields are given a variable type of String, not Numeric on the Variables tab. If you have any of those values set as Numeric, you will need to convert them to a string using a Rules function like Str() before you assign them as an argument to AsciiOutput.
"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.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
- Chengooi
- Posts: 64
- Joined: Tue Jan 13, 2009 7:46 am
- OLAP Product: TM1
- Version: 9.4
- Excel Version: 2003
- Location: Auckland, New Zealand
- Contact:
Re: asciioutput()
success but almost!
I managed to output the cms file and with values !! but outting the line in data tab, but the Value (data) did not come across, I wonder why
NewAccounts String 00000 Element
TBRANCH String P6061 Element
Period String 39872 Element
Actbud String Actual Element
Data String MTD Element
Value Numeric 0.000000 Data
Thanks Alan for your excellent advice!!
I managed to output the cms file and with values !! but outting the line in data tab, but the Value (data) did not come across, I wonder why
NewAccounts String 00000 Element
TBRANCH String P6061 Element
Period String 39872 Element
Actbud String Actual Element
Data String MTD Element
Value Numeric 0.000000 Data
Thanks Alan for your excellent advice!!
The most wasted of all days is one without laughter.
e e cummings (1894-1962)
e e cummings (1894-1962)
- Alan Kirk
- Site Admin
- Posts: 6606
- 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()
I always set the Contents to "Other" rather than "Element" or "Data"; those settings are only useful if you're using generated code, which I never do. (And if all you're doing is an AsciiOutput, you aren't either.)Chengooi wrote:success but almost!
I managed to output the cms file and with values !! but outting the line in data tab, but the Value (data) did not come across, I wonder why
NewAccounts String 00000 Element
TBRANCH String P6061 Element
Period String 39872 Element
Actbud String Actual Element
Data String MTD Element
Value Numeric 0.000000 Data
Thanks Alan for your excellent advice!!
If you aren't getting a compile error then presumably you have made some attempt to convert the Value field from a numeric to a string; my guiess would be that there's something wrong with the way you're doing that. Again we'd need to see the code that you're using.
"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.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
- Chengooi
- Posts: 64
- Joined: Tue Jan 13, 2009 7:46 am
- OLAP Product: TM1
- Version: 9.4
- Excel Version: 2003
- Location: Auckland, New Zealand
- Contact:
Re: asciioutput()
Hi Alan,
I managed to output a file from the code asciioutput('path and filename',1,2,3,4,5,6);
the datasource is a view.
Now to go one step further the file created gave me data at zero level, I needed at consolidation level.
I had a played around the variable tab and set the content of one of the variables to consolidation, then in the advance tab, dimension definition pop up with errors that seeking defination of dimension name and child, but the pop up did not allow me to type anything on it. I wonder where is the control and where I have to fix to move on.
I wonder if you have any sample for me to copy, my cube view has 5 dimensions namely : accounts ( contain consolidations and zero level ), cost centres, period, actual and mtd and then data.
My success so far gave me the file output I wanted but I need it to be at consolidation level for the account dimension , how do I tell it?
My cube view was saved at consolidation level 1.
I managed to output a file from the code asciioutput('path and filename',1,2,3,4,5,6);
the datasource is a view.
Now to go one step further the file created gave me data at zero level, I needed at consolidation level.
I had a played around the variable tab and set the content of one of the variables to consolidation, then in the advance tab, dimension definition pop up with errors that seeking defination of dimension name and child, but the pop up did not allow me to type anything on it. I wonder where is the control and where I have to fix to move on.
I wonder if you have any sample for me to copy, my cube view has 5 dimensions namely : accounts ( contain consolidations and zero level ), cost centres, period, actual and mtd and then data.
My success so far gave me the file output I wanted but I need it to be at consolidation level for the account dimension , how do I tell it?
My cube view was saved at consolidation level 1.
The most wasted of all days is one without laughter.
e e cummings (1894-1962)
e e cummings (1894-1962)
- Steve Rowe
- Site Admin
- Posts: 2417
- Joined: Wed May 14, 2008 4:25 pm
- OLAP Product: TM1
- Version: TM1 v6,v7,v8,v9,v10,v11+PAW
- Excel Version: Nearly all of them
Re: asciioutput()
Hi Chengooi,
Thought I'd give Alan a break
First what type you say on the variable tab is what the value already is not what you want it to be, for example if you have a 0-level data source then you setting the variable type to consolidation does not magically change the definition of your view.
Have you unchecked the ignore consoldaitions tick box?
Your original process that worked with the original view should work with no changes on a different view of the same cube, it's your data source that is the problem.
HTH, ASCIIOutput is just about the easiest command to use in TI, the only thing to watch out for is that it won't export numbers so you have to convert them to strings first.
Cheers,
Thought I'd give Alan a break
First what type you say on the variable tab is what the value already is not what you want it to be, for example if you have a 0-level data source then you setting the variable type to consolidation does not magically change the definition of your view.
Have you unchecked the ignore consoldaitions tick box?
Your original process that worked with the original view should work with no changes on a different view of the same cube, it's your data source that is the problem.
HTH, ASCIIOutput is just about the easiest command to use in TI, the only thing to watch out for is that it won't export numbers so you have to convert them to strings first.
Cheers,
Technical Director
www.infocat.co.uk
www.infocat.co.uk
- Chengooi
- Posts: 64
- Joined: Tue Jan 13, 2009 7:46 am
- OLAP Product: TM1
- Version: 9.4
- Excel Version: 2003
- Location: Auckland, New Zealand
- Contact:
Re: asciioutput()
We had thought about that but how do you unchecked the ignore consoldations tick box in a cube view, that check bos is only available when you right click on a cube, on cube viewer , there is no such check box for it. or have I missed out something.
The most wasted of all days is one without laughter.
e e cummings (1894-1962)
e e cummings (1894-1962)
- Steve Rowe
- Site Admin
- Posts: 2417
- Joined: Wed May 14, 2008 4:25 pm
- OLAP Product: TM1
- Version: TM1 v6,v7,v8,v9,v10,v11+PAW
- Excel Version: Nearly all of them
Re: asciioutput()
The short answer is Yes.
A "normal" cube view that a user uses behaves like one of the "right click export as ASCII" views when used by a TI. So you want to set up your source view using the export as ascci option rather than just saving a cube view.
Cheers
A "normal" cube view that a user uses behaves like one of the "right click export as ASCII" views when used by a TI. So you want to set up your source view using the export as ascci option rather than just saving a cube view.
Cheers
Technical Director
www.infocat.co.uk
www.infocat.co.uk
- Chengooi
- Posts: 64
- Joined: Tue Jan 13, 2009 7:46 am
- OLAP Product: TM1
- Version: 9.4
- Excel Version: 2003
- Location: Auckland, New Zealand
- Contact:
Re: asciioutput()
I did exactly what you said and it was a success , I am over the moon!!!
Now I have a new problem, I want the zero level to be shown underneath the consolidation, I think I should be able to sux this out myself eh!!
Thanking you kindly!!
Now I have a new problem, I want the zero level to be shown underneath the consolidation, I think I should be able to sux this out myself eh!!
Thanking you kindly!!
The most wasted of all days is one without laughter.
e e cummings (1894-1962)
e e cummings (1894-1962)