How to Create Headers in AsciiOutput

I was creating a text file the other day using AsciiOutput and then realised that I needed to have a header line in there with column headers. The column headings are useful for then uploading into an external database with some confidence that each column is what you expect and also can form the identifiers in a subsequent TI to reload the data into TM1.

Method to Create Headers in AsciiOutput

So how’d I do it?  Pretty easy really.

On the Prolog tab I defined a variable, lets call it vHeader and made it equal to 1.

Then on the tab where you’re running the AsciiOutput, insert an IF statement and an additional AsciiOutput right before the AsciiOutput for the data. So something like this (note in this example I have defined variables for the path and filenames already):

If ( vHeader = 1);

AsciiOutput ( vPath | vFile, 'heading1', 'heading2', 'heading3'... 'headingN');

vHeader = vHeader + 1;

Endif;

AsciiOutput ( vPath | vFile, 'data1', 'data2', 'data3'... 'dataN');

If you like this post, please spread the love…

About John

Managing Director of Infocube. We are a management accounting consultancy that specialises in Business Analytics.
This entry was posted in TI Coding, TI Data Sources, TI Functions. Bookmark the permalink.

One Response to "How to Create Headers in AsciiOutput"

Log in to post a comment.