custom ASCIIOutput

Post Reply
kbogies
Posts: 31
Joined: Tue Jun 10, 2008 8:21 pm
OLAP Product: TM1
Version: 9.1sp4 64x
Excel Version: 2003
Location: Hartford, CT

custom ASCIIOutput

Post by kbogies »

Does anyone know how to export via ASCIIOutput with the measures dimension going across the flat file? The data set is too large to build a custom view via the cube viewer, so i'm looking for an 'across' statement. Syntax is below. :?:

ASCIIOutput('\\tm1server\Data\Extract.csv', Vyear, scenario, channels, product, type, measure, Vmonth, Value);

Thanks!
Kbogies
User avatar
Martin Ryan
Site Admin
Posts: 1989
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: custom ASCIIOutput

Post by Martin Ryan »

Right click on the cube and click "Export as ASCII data..." Just click Export to export the entire cube.

Is that what you mean?

Martin
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
User avatar
Steve Vincent
Site Admin
Posts: 1054
Joined: Mon May 12, 2008 8:33 am
OLAP Product: TM1
Version: 10.2.2 FP1
Excel Version: 2010
Location: UK

Re: custom ASCIIOutput

Post by Steve Vincent »

you mean something like;

Code: Select all

                     m1          m2              m3
a b c                10          20               30
b c a                15           5               35
Where that would normally be 6 seperate lines on the ASCII file?

Not got time to check now, but if that's what you are aiming at i'm guessing an IF / ElseIF loop would be needed, depending on how many measures you have as the embeded IF's are limited to 16. Never tried before, although i have passed such a file back in via TI. 320+ fields, now that was fun! :)
If this were a dictatorship, it would be a heck of a lot easier, just so long as I'm the dictator.
Production: Planning Analytics 64 bit 2.0.5, Windows 2016 Server. Excel 2016, IE11 for t'internet
kbogies
Posts: 31
Joined: Tue Jun 10, 2008 8:21 pm
OLAP Product: TM1
Version: 9.1sp4 64x
Excel Version: 2003
Location: Hartford, CT

Re: custom ASCIIOutput

Post by kbogies »

Steve, I think you're understanding correctly what i'm looking to do, however, wouldn't an IF statement work as a filter (not what i want)? Just to clarify, this needs to be a TI process to schedule as a regular chore. Currently I have the statement below in the Advanced Data section, but need to add an "across measures" or similar statement. The end user needs it to be reformatted to have the measures dimension listed across the top rather than one of the columns.

ASCIIOutput('\\tm1server\Data\Extract.csv', Vyear, scenario, channels, product, type, measure, Vmonth, Value);

there are 7 dimensions (Vyear, scenario, channels, product, type, measure, Vmonth) and when exported they appear as 7 columns for each dimension and 1 column for the data. The desired result is 6 columns for the dimensions + X number of measure columns with data filled below... similar to a pivot table look.


Thanks,
Kbogies
Mike L
Posts: 58
Joined: Fri Jun 13, 2008 4:01 pm

Re: custom ASCIIOutput

Post by Mike L »

The problem you see is that TI wants to process one intersection at a time, and you want to output a row from a two dimensional view. There is a way, but it is a little cimbersome:

This assumes the elements of your measure dimension are static, and there is one element, call it measure1, that is aguaranteed to be populated whenever any element in the row is populated.

Set up a view of measure1 as your data source and use additional DB() functions to pull each other measure, like this:

ASCIIOutput('somefile.csv', Vyear, scenario, channels, product, type, Vmonth, value, DB(year, scenario, channels, product, type, 'measure2', month), DB(year, scenario, channels, product, type, 'measure3', month), ... etc. ...);

You can DB() the other values into separate variables in separate statements to make the ASCIIOuput statement manageable.
kbogies
Posts: 31
Joined: Tue Jun 10, 2008 8:21 pm
OLAP Product: TM1
Version: 9.1sp4 64x
Excel Version: 2003
Location: Hartford, CT

Re: custom ASCIIOutput

Post by kbogies »

There is no measure which is guarenteed to be populated for each intersection, so i guess that won't work :cry: I'll keep my eyes open for additional suggestions.

Thanks,
Kbogies
Mike L
Posts: 58
Joined: Fri Jun 13, 2008 4:01 pm

Re: custom ASCIIOutput

Post by Mike L »

Ok. That caveat only applies if you are using a zero-suppressed view. If the cube is not sparse you could turn off zero suppression and output the whole thing. It sounds like it is sparse though, so that would give you zillions of empty rows.

Another approach would be to create a new measure guaranteed to have the desired property. It could be a consolidation of other measures, or it could be derived by a rule. This approach makes clutter, and in the case of rules it could hurt performance.

Perhaps your best option would be to process this in two passes:
1) A preliminary process using a view like your original and building a temporary cube without a measures dimension, using CellPutN to send a 1 to each place the view returns a value.
2) A main process using a view of the temporary cube, with CellGetN formulas as above to pull each measure from the main cube for ASCIIOutput. (Yes, I meant CellGetN not DB. Don't get me started on naming things differently in each component of TM1.)
User avatar
Steve Vincent
Site Admin
Posts: 1054
Joined: Mon May 12, 2008 8:33 am
OLAP Product: TM1
Version: 10.2.2 FP1
Excel Version: 2010
Location: UK

Re: custom ASCII Output

Post by Steve Vincent »

Mike is right, you must find a way to get "a" measure populated otherwise you'll never have a datasource that will pick up all of the entries. The only easy way to do that is to consolidate all the measures and use just the consolidation in the datasourceview view. You can then use Cellgen calls to populate a variable for each measure;

Code: Select all

M1 = Cellgen(year, scenario, channels, product, type, 'measure1', month);
M2 = Cellgetn(year, scenario, channels, product, type, 'measure2', month);
M3 = Cellgetn(year, scenario, channels, product, type, 'measure3', month);
etc
And then output the file using;

Code: Select all

ASCII Output('somefile.csv', Year, scenario, channels, product, type, Vmonth , M1 , M2 , M3 );
It will only work tho if you have a consolidation for ALL the measures tho.
If this were a dictatorship, it would be a heck of a lot easier, just so long as I'm the dictator.
Production: Planning Analytics 64 bit 2.0.5, Windows 2016 Server. Excel 2016, IE11 for t'internet
Eije Wiersema
Posts: 2
Joined: Thu Jun 17, 2010 10:20 am
OLAP Product: TM1
Version: TM1 9.5
Excel Version: 2007

Re: custom ASCIIOutput

Post by Eije Wiersema »

Hi,

This is a really late reply, but this can be done quite easy. If you have for example three dimensions Account, Entity and Period you can add 12 new variables M1, M2, M3,M4,M5 etc in the TI.

Then put the following formula in for M1=IF(Period@='Jan',Value,'0') and for M2=IF(Period@='Feb',Value,'0') and so on. This ofcourse also can be done with a measure dimension.

Then the asciioutput will look like AsciiOutput('C:\export.cma',Accounts,Entity,M1,M2,M3,...);

Maybe somebody still can use it.

Cheers,
Eije
Post Reply