asciioutput using NOW as the name of the file

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

asciioutput using NOW as the name of the file

Post by kbogies »

I'm trying to write a control process that will generate an ascii file with the current month & current year as the name of the file. can someone correct my syntax please?

Code: Select all

ASCIIOutput('C:\temp\'|Now|'.txt, yr_mo);
where "yr_mo" is the variable that will be displayed in the text file.
User avatar
wissew
Posts: 54
Joined: Tue Jun 17, 2008 7:24 pm
OLAP Product: TM1
Version: 9.5.2; 10.2.2; 11
Excel Version: 2003 SP3 - 2013
Location: Beaverton, OR

Re: asciioutput using NOW as the name of the file

Post by wissew »

kbogies wrote:I'm trying to write a control process that will generate an ascii file with the current month & current year as the name of the file. can someone correct my syntax please?

Code: Select all

ASCIIOutput('C:\temp\'|Now|'.txt, yr_mo);
where "yr_mo" is the variable that will be displayed in the text file.

K,
Here's a block that will help.

filename = TIMST(now, '\Y\m\d\h\i\s');
vDate = timst(now, '\Y\m\d');
vTime = timst(now, '\h:\i:\s');
ASCIIOutput('\\SERVER\F$\TM1DBMS\TM1Data\DeptFSUpdate2_Deletions'|filename|'.log', vParent,'Deleted on '|vDate|' at '|vTime);

Let me know if you have problems with it.

Wes
frosterrj
Posts: 17
Joined: Tue Jun 17, 2008 10:44 pm
OLAP Product: TM1 9.1.4 64-bit
Version: Olap Objects and TM1 Web
Excel Version: 2003
Location: Seattle, WA; Oakland, CA

Re: asciioutput using NOW as the name of the file

Post by frosterrj »

at the risk of hijacking this thread,
is there a way to use the timst function and convert to numeric something so that (in my case) a time-elapesed element that is held in a cube could be added up by the parent element roll-up?

I tried stringtonumber but got some 'real number' errors...

thatnks,
User avatar
wissew
Posts: 54
Joined: Tue Jun 17, 2008 7:24 pm
OLAP Product: TM1
Version: 9.5.2; 10.2.2; 11
Excel Version: 2003 SP3 - 2013
Location: Beaverton, OR

Re: asciioutput using NOW as the name of the file

Post by wissew »

I don't believe it requires conversion. Have you tried just shooting TIMST(now, '\Y\m\d\h\i\s') in to the cube?
frosterrj
Posts: 17
Joined: Tue Jun 17, 2008 10:44 pm
OLAP Product: TM1 9.1.4 64-bit
Version: Olap Objects and TM1 Web
Excel Version: 2003
Location: Seattle, WA; Oakland, CA

Re: asciioutput using NOW as the name of the file

Post by frosterrj »

I have it working with a process start and endtime, and the difference (elapsed time), but the elapsed time can't be added up across processes because it's a string. I tried to convert it to a number with stringtonumber, but it just choked.

trying to figure out how to get non-string elapsed time...
lotsaram
MVP
Posts: 3703
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: asciioutput using NOW as the name of the file

Post by lotsaram »

This is a common problem that unfortunately does not have an "easy" solution. Although TM1 has a wealth of time and date functions to convert a serial number into a date string or numeric component (for day, month or year), no one has seen fit to provide any functions which do the reverse and provide a serial number when given a date or time input. (Actually there is DAYNO but it stops short of what you need as it will only provide a serial date from a yy-mm-dd date string, there is no equivalent in TM1 for time information.)

Depending on what you are recording there are two ways to do this. If everything is internal in TI then in addition to generating a string variable for your starting time and finishing time also include a numeric variable simply equal to NOW() at the start and finish. Elapsed time is then simply finish - start with some minor fussing around to convert to a decipherable time format.

If some of the timestamps are externally generated then the route is a little harder. Computationally the simplest method is to reduce the start and finish time to seconds, e.g. if your time is in the format HH:mm:ss then Start = (3600 * HH) + (60 * mm) + ss likewise with finish time and elapsed time in seconds is then again simply finish - start (provided of course that you do not pass midnight during the elapsed time whereby it gets more complicated.)

I don't have time to provide more information but that should be enough information to figure it all out, HTH.
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: asciioutput using NOW as the name of the file

Post by kbogies »

thanks Wes! i just revisited this and it seems the numbertostring function on the yr_mo variable wasn't there (i truely need more pairs of eyes over here!)
katie
Post Reply