ASCII Output & TextOutput

Post Reply
appleglaze28
Regular Participant
Posts: 269
Joined: Tue Apr 21, 2009 3:43 am
OLAP Product: Cognos TM1, Planning
Version: 9.1 SP3 9.4 MR1 FP1 9.5
Excel Version: 2003

ASCII Output & TextOutput

Post by appleglaze28 »

I was told to test the ODBCOutput by doing ASCIIOutput first...So this is my understanding on how to create an ASCIIOutput File base on th PDF included in the installation.

When I pick a specific TM1 Cube View, do I have to define everything as String? or do I define the column containing the values as Numeric. If so, I can't to make it work, I can only make the the value field work if I define it as a String and contents are all defined as OTHERS. I can't make the value as Data.

As expected when I opened the ASCII file, the value is not formatted correctly. How will I know if this will even go in my datasource if all variables are string?
Alan Kirk
Site Admin
Posts: 6645
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: ASCII Output & TextOutput

Post by Alan Kirk »

appleglaze28 wrote:I was told to test the ODBCOutput by doing ASCIIOutput first...So this is my understanding on how to create an ASCIIOutput File base on th PDF included in the installation.

When I pick a specific TM1 Cube View, do I have to define everything as String? or do I define the column containing the values as Numeric. If so, I can't to make it work, I can only make the the value field work if I define it as a String and contents are all defined as OTHERS. I can't make the value as Data.
All of the arguments that you pass to an AsciiOutput command have to be strings. If a value is numeric (which is typically the case with the Value variable of a cube view, assuming that you aren't storing strings in the cube), you have to convert it first.

Use either the Str() rules function, or the NumberToString (or NumberToStringEx) TI functions to convert the Value field, which you can then leave as a Numeric type.

I generally define all variables as having a content of "Other" (or "Ignore") because I never use TI-generated code; I write it all myself. The other content values are only useful (for certain values of "useful") if you're using the Maps tab.
"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.
appleglaze28
Regular Participant
Posts: 269
Joined: Tue Apr 21, 2009 3:43 am
OLAP Product: Cognos TM1, Planning
Version: 9.1 SP3 9.4 MR1 FP1 9.5
Excel Version: 2003

Re: ASCII Output & TextOutput

Post by appleglaze28 »

So base on what you say its not necessary to test ASCIIOutput on the cube that you want to load to a database like what David recommended in my previous post?

http://forums.olapforums.com/viewtopic.php?f=3&t=932

I just need to make sure the my ODBCOutput statement contains single quote for all string elements and the numeric will be as is?
Alan Kirk
Site Admin
Posts: 6645
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: ASCII Output & TextOutput

Post by Alan Kirk »

appleglaze28 wrote:So base on what you say its not necessary to test ASCIIOutput on the cube that you want to load to a database like what David recommended in my previous post?

http://forums.olapforums.com/viewtopic.php?f=3&t=932

I just need to make sure the my ODBCOutput statement contains single quote for all string elements and the numeric will be as is?
You're talking about two completely different things. In this thread you were asking why your AsciiOutput command wasn't working. The reason for that, as I said, is that you have to ensure that all of the arguments to the AsciiOutput function are strings.

If you have a 3 dimensional cube where Dim1, Dim2 and Dim3 are defined as String with a content type of Other, and Value is defined as Numeric with a content type of other, then this will work:

Code: Select all

AsciiOutput ( 'OutputFile.txt', Dim1, Dim2, Dim3, NumberToString (Value));
This, however, will not:

Code: Select all

AsciiOutput ( 'OutputFile.txt', Dim1, Dim2, Dim3, Value);
The reason for that is, as I said, that AsciiOutput requires every argument to be a string. This has nothing to do with what David was saying.

However David's not recommending that you output the values from the cube view anyway; he's recommending that you output the SQLQuery that you intend to feed to the ODBCOutput to ensure that you have the syntax correct. And the SQLQuery argument has to be a string, which means that you need to convert any numeric values to a string at some point anyway (unless you bring the value in as a string in the first place) because unlike VB/A, TI won't do an implicit data type conversion.
"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.
Post Reply