Cube Data Export
-
- Posts: 52
- Joined: Thu Feb 17, 2011 2:52 pm
- OLAP Product: TM1
- Version: 9.5
- Excel Version: 2007
Cube Data Export
Does anyone know if there is a TI function that will export a all cube data both string and numeric in the same manner as right clicking the cube and choosing 'export to text file'. I tried ASCIIOutput, TextOutput, and right clicking cube and chosing 'export to text file' however, I only get the string values and not the numerical values. Am I missing something in these functions?
-
- Community Contributor
- Posts: 211
- Joined: Tue Sep 15, 2009 11:13 pm
- OLAP Product: IBMPA
- Version: PA 2.0 Cloud
- Excel Version: 2010
Re: Cube Data Export
try numbertostring function
put
put
Code: Select all
IF( VALUE_IS_STRING <> 1 );
ASCIIOUTPUT( filename, vDim1, vDim2, vDim3,vvalue);
ELSE;
ASCIIOUTPUT( filename, vDim1, vDim2, vDim3,numbertostring( vvalue),);
ENDIF;
GG
-
- 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: Cube Data Export
It might be an idea to post your exact code. BigG is right about needing to convert a value to a string, but if you aren't doing that already you should actually be getting a syntax error ("invalid string expression") when you try to save the process since AsciiOutput can't work with a numeric argument.dfrench77 wrote:Does anyone know if there is a TI function that will export a all cube data both string and numeric in the same manner as right clicking the cube and choosing 'export to text file'. I tried ASCIIOutput, TextOutput, and right clicking cube and chosing 'export to text file' however, I only get the string values and not the numerical values. Am I missing something in these functions?
"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.
-
- 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: Cube Data Export
If you are processing a view you shouldn't need to check for data type. You can just use the inbuilt sValue variable.
-
- 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: Cube Data Export
If it's a mixture of strings and numbers, you do still to need to check for type unless you're OK with generating an error log. sValue is the conversion of numeric values to a string, and works fine when the value is numeric, but if you use it when the value is already a string you get an error "Cannot convert field number n, value "x" to a real number". Which of course isn't what you'd expect, since you don't want it to be a real number, you want a string. My guess is that it's trying to read in the cube value as a number so that it can convert it to a string, then getting a shock when it finds out the the cube value isn't one. (This is the behaviour that I noticed in past versions but I'm still seeing it in 9.5.1.)lotsaram wrote:If you are processing a view you shouldn't need to check for data type. You can just use the inbuilt sValue variable.
Interestingly the help file is still bass-ackwards on this claiming that:
Except, as I just confirmed by test... if the value is a string, all you get from sValue is a minor error in an error log.SValue
When the DatasourceType is 'VIEW', this TurboIntegrator local variable determines the value of the current cell when Value_Is_String is not 0. (That is, when the current cell contains a string.)
I'd usually do the test that BigG recommended just to prevent the error log from generating, though I usually use the Str() function to do the conversion rather than sValue or numbertostring only because it gives me finer control over the number of decimal places. To each their own on that one.
"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.
-
- 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: Cube Data Export
Weird that is not what you would expect. Usually I just shortcut the lookup and export sValue. I suppose when I am doing this it is always to export numeric data only but this is definately A over T.
So if data is mixed you need..
IF( value_is_string = 1 );
ASCIIOutput(filename, ...., Value);
Else;
ASCIIOutput(filename, ...., sValue);
EndIF;
What a load of ......
So if data is mixed you need..
IF( value_is_string = 1 );
ASCIIOutput(filename, ...., Value);
Else;
ASCIIOutput(filename, ...., sValue);
EndIF;
What a load of ......
- Steve Rowe
- Site Admin
- Posts: 2464
- 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: Cube Data Export
If you are only doing an ASCIIOutput then you can just set the value variable to a string in the variables tab and then you don't do anything special when you get to the actual export.
Or am I missing something?
Or am I missing something?
Technical Director
www.infocat.co.uk
www.infocat.co.uk
-
- 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: Cube Data Export
Apparently not.Steve Rowe wrote:If you are only doing an ASCIIOutput then you can just set the value variable to a string in the variables tab and then you don't do anything special when you get to the actual export.
Or am I missing something?

(Personally I still wouldn't do it that way because it provides no decimal truncation and I'm not wildly crazy about how integer values export with a decimal point but nothing after it, but it's a perfectly valid option.)
"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.
-
- Posts: 52
- Joined: Thu Feb 17, 2011 2:52 pm
- OLAP Product: TM1
- Version: 9.5
- Excel Version: 2007
Re: Cube Data Export
All,
Thanks for you many and varied comments. In file attachment I provide sample cube view and sample of the Asciioutput file. Thanks
Steve - I tried setting the value variable to a string and not performing any conditonal test or converting to numeric to string, but I only get the string data output in the text file. See attached file
Lotsaram - Using the sValue code that you recommended save with out a syntax error but the export file only generated the string data. See attached file.
IF( value_is_string = 1 );
ASCIIOUTPUT('C:\TM1_Applications\TM1_Servers\TransferCube.cma', Departments, Employees, vSalary_Fields, Value);
Else;
ASCIIOUTPUT('C:\TM1_Applications\TM1_Servers\TransferCube.cma', Departments, Employees, vSalary_Fields,sValue);
EndIF;
Alan and BigG - The number to string code throws an invalid string expression error either when the value variable is set to string or numeric. See attached file
IF( VALUE_IS_STRING <> 1 );
ASCIIOUTPUT('C:\TM1_Applications\TM1_Servers\TransferCube.cma', Departments, Employees, vSalary_Fields, Value);
ELSE;
ASCIIOUTPUT('C:\TM1_Applications\TM1_Servers\TransferCube.cma', Departments, Employees, vSalary_Fields,numbertostring(Value),);
ENDIF;
Thanks for you many and varied comments. In file attachment I provide sample cube view and sample of the Asciioutput file. Thanks
Steve - I tried setting the value variable to a string and not performing any conditonal test or converting to numeric to string, but I only get the string data output in the text file. See attached file
Lotsaram - Using the sValue code that you recommended save with out a syntax error but the export file only generated the string data. See attached file.
IF( value_is_string = 1 );
ASCIIOUTPUT('C:\TM1_Applications\TM1_Servers\TransferCube.cma', Departments, Employees, vSalary_Fields, Value);
Else;
ASCIIOUTPUT('C:\TM1_Applications\TM1_Servers\TransferCube.cma', Departments, Employees, vSalary_Fields,sValue);
EndIF;
Alan and BigG - The number to string code throws an invalid string expression error either when the value variable is set to string or numeric. See attached file
IF( VALUE_IS_STRING <> 1 );
ASCIIOUTPUT('C:\TM1_Applications\TM1_Servers\TransferCube.cma', Departments, Employees, vSalary_Fields, Value);
ELSE;
ASCIIOUTPUT('C:\TM1_Applications\TM1_Servers\TransferCube.cma', Departments, Employees, vSalary_Fields,numbertostring(Value),);
ENDIF;
- Attachments
-
- TM1 TI Cube Data Export.docx
- (67.08 KiB) Downloaded 531 times
-
- 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: Cube Data Export
If the export is generating only string data and you see numeric data also in the view
- is the numeric data rule calculated?
- are the rules properly fed?
Unless rule calculated leaf values are fed the records will be skipped if skipping zero values.
- is the numeric data rule calculated?
- are the rules properly fed?
Unless rule calculated leaf values are fed the records will be skipped if skipping zero values.
-
- Posts: 52
- Joined: Thu Feb 17, 2011 2:52 pm
- OLAP Product: TM1
- Version: 9.5
- Excel Version: 2007
Re: Cube Data Export
Lotsram - Yes the numerica data and string data were calculated by rules and the feeders were not in place. Thanks for your help and guidance.
Regards,
dfrench77
Regards,
dfrench77