Asciioutout is overwriting the file,BUT i want it is once TI

Post Reply
svchowdary83
Posts: 7
Joined: Thu Aug 02, 2012 12:31 pm
OLAP Product: cognos TM1
Version: 9.5.1
Excel Version: 2010

Asciioutout is overwriting the file,BUT i want it is once TI

Post by svchowdary83 »

I have one ASCIIOUTPUT under the prolog tab and as soon as TI excutes asciioutout is overwriting the file.BUT i want it is once TI excutes i have to add the new data into the existed txt file.is it possible? If possible how
Alan Kirk
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: Asciioutout is overwriting the file,BUT i want it is onc

Post by Alan Kirk »

svchowdary83 wrote:I have one ASCIIOUTPUT under the prolog tab and as soon as TI excutes asciioutout is overwriting the file.BUT i want it is once TI excutes i have to add the new data into the existed txt file.is it possible? If possible how
This is a not uncommon request, since it's a function which would actually be useful. However IBM is too busy building unwieldily, monolithic Java applications with pretty chrome trimmings to concern itself with such mundane pursuits. The easiest way to achieve this is the method mentioned in Mike Cowie's post in this thread.
"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.
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Asciioutout is overwriting the file,BUT i want it is onc

Post by tomok »

The method I use to do this is to move the actual ASCIIOUTPUT statement you have in the Prolog tab into the Data tab, add a variable counter, and then encapsulate that single statement inside an IF that only executes for the first record. You can still leave all the code that generates the output in the Prolog, just actually write the result in Data. Like this:

Prolog

Code: Select all

StringtoOutput = WhateverCodeYouAreUsing;
NumRecs = 0;
Data

Code: Select all

IF(NumRecs < 1);
  ASCIIOUTPUT(FileName, StringtoOutput);
ENDIF;

Rest of Data tab code
........
NumRecs = NumRecs + 1;
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Post Reply