Concatenate data using ASCIIOUTPUT

Post Reply
tm1_user
Posts: 18
Joined: Thu Nov 13, 2014 10:03 am
OLAP Product: TM1
Version: 10.2.0
Excel Version: 2010

Concatenate data using ASCIIOUTPUT

Post by tm1_user »

Hi All,

I have a written a TI Process which generates data from the Cube and writes to a file using ASCIIOUTPUT.

In this TI Process, the text is generated in PROLOG tab and DATA tab.
I want all the text to be written into a single file (Prolog tab generated Data and then Data tab generated Data).

If I use same file name in Prolog and Data tabs, the Prolog generated data is overwritten by Data tab generated data.

Is there any method to append the data from both tabs.

Cheers
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: Concatenate data using ASCIIOUTPUT

Post by tomok »

tm1_user wrote:Hi All,

I have a written a TI Process which generates data from the Cube and writes to a file using ASCIIOUTPUT.

In this TI Process, the text is generated in PROLOG tab and DATA tab.
I want all the text to be written into a single file (Prolog tab generated Data and then Data tab generated Data).

If I use same file name in Prolog and Data tabs, the Prolog generated data is overwritten by Data tab generated data.

Is there any method to append the data from both tabs.

Cheers
Let me give you a tip. Just blindly asking questions that can be easily answered by either reading the docs or doing a search on this forum is not going to curry you much favor with the contributors of this group. In your case a quick search of this forum will turn up a number of posts about this very topic. This question get's asked, at some point, by almost every new developer.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
User avatar
jim wood
Site Admin
Posts: 3958
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: Concatenate data using ASCIIOUTPUT

Post by jim wood »

By searching concatenate file you get this......
http://www.tm1forum.com/viewtopic.php?f=19&t=516
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
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: Concatenate data using ASCIIOUTPUT

Post by tomok »

I'm pretty sure this is what he is looking for:

http://www.tm1forum.com/viewtopic.php?f=3&t=3245
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
User avatar
jim wood
Site Admin
Posts: 3958
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: Concatenate data using ASCIIOUTPUT

Post by jim wood »

tomok wrote:I'm pretty sure this is what he is looking for:

http://www.tm1forum.com/viewtopic.php?f=3&t=3245
I'm not sure how you got to headings? It sounded to me like he's trying to concatenate text generated from 2 different tabs, which as the link I specified said, you can only do this using a dos command to append 2 files. Or have I gone mad??????
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
declanr
MVP
Posts: 1828
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: Concatenate data using ASCIIOUTPUT

Post by declanr »

jim wood wrote:It sounded to me like he's trying to concatenate text generated from 2 different tabs, which as the link I specified said, you can only do this using a dos command to append 2 files. Or have I gone mad??????
Or my personal favourite of doing 2 bulk inserts to a sql table and then exporting the lot into a new file; sounds like overkill but after bitter experience I have now ended up going down the route of putting everything out to SQL with a timestamp at every possible opportunity so that I can "keep an eye on things"... even when only a CSV extract is needed I will always throw it into SQL as well; especially if the extract is going elsewhere afterwards - as you inevitably get someone saying "You didn't give us that number; TM1 must be wrong" when it turns out they just decided to fudge the extract and "forgot" all about it when pulled up on the fact.

Am I sounding cynical today? :roll:
Declan Rodger
User avatar
jim wood
Site Admin
Posts: 3958
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: Concatenate data using ASCIIOUTPUT

Post by jim wood »

It's a bit anal I'll give that, but it's not a bad plan. Better safe than sorry.
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
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: Concatenate data using ASCIIOUTPUT

Post by tomok »

jim wood wrote:
tomok wrote:I'm pretty sure this is what he is looking for:

http://www.tm1forum.com/viewtopic.php?f=3&t=3245
I'm not sure how you got to headings? It sounded to me like he's trying to concatenate text generated from 2 different tabs, which as the link I specified said, you can only do this using a dos command to append 2 files. Or have I gone mad??????
Headings? It doesn't really matter what you want to write but if you want to write a line(s) to a file on the Prolog and then continue writing to the same file in the Data tab it's quite simple:

1) Add a counter variable.
2) In the prolog set it to 0
3) Move the ASCIIOutput code you previously wanted to write in the Prolog tab to the Data tab, put it at the top and then have an IF to execute it only when the counter is 0
4) Have your regular Data tab ASCIIOutputs
5) Increment the counter by 1

This technique will work regardless of what's in the actual ASCIIOutputs. Everything will go in one file. I use it all the time. If you have more than one line to write out in the Prolog then just up your counter and put those extra lines inside the IF statement at the top of the Data tab.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
User avatar
jim wood
Site Admin
Posts: 3958
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: Concatenate data using ASCIIOUTPUT

Post by jim wood »

Tomok,

If you click on the link you posted it talks about how to set a counter to make sure the headers in a file are written once. It has nothing to do with merging files, hence my question,

Jim.
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
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: Concatenate data using ASCIIOUTPUT

Post by tomok »

jim wood wrote:Tomok,

If you click on the link you posted it talks about how to set a counter to make sure the headers in a file are written once. It has nothing to do with merging files, hence my question,

Jim.
If you read the original post that's exactly what he's talking about, the fact that if you write to a file in the Prolog and then write to the SAME FILE in the Data tab then the stuff you wrote in the Prolog disappears. Hence my link that talks about how you can get around that. Merging the output of two separate files AFTER a TI finishes is an entirely different conversation.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
tm1_user
Posts: 18
Joined: Thu Nov 13, 2014 10:03 am
OLAP Product: TM1
Version: 10.2.0
Excel Version: 2010

Re: Concatenate data using ASCIIOUTPUT

Post by tm1_user »

tomok wrote:
jim wood wrote:
tomok wrote:I'm pretty sure this is what he is looking for:

http://www.tm1forum.com/viewtopic.php?f=3&t=3245
I'm not sure how you got to headings? It sounded to me like he's trying to concatenate text generated from 2 different tabs, which as the link I specified said, you can only do this using a dos command to append 2 files. Or have I gone mad??????
Headings? It doesn't really matter what you want to write but if you want to write a line(s) to a file on the Prolog and then continue writing to the same file in the Data tab it's quite simple:

1) Add a counter variable.
2) In the prolog set it to 0
3) Move the ASCIIOutput code you previously wanted to write in the Prolog tab to the Data tab, put it at the top and then have an IF to execute it only when the counter is 0
4) Have your regular Data tab ASCIIOutputs
5) Increment the counter by 1

This technique will work regardless of what's in the actual ASCIIOutputs. Everything will go in one file. I use it all the time. If you have more than one line to write out in the Prolog then just up your counter and put those extra lines inside the IF statement at the top of the Data tab.

Thank you all for the responses. There are no headings required on the output. Its only the data from the cube.

@Tomok, I have followed the above steps, it simply worked!! :)
Post Reply