Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Timestamp in webfocus reports
Go
New
Search
Notify
Tools
Reply
  
Timestamp in webfocus reports
 Login/Join
 
<eli>
posted
Hi,
I am writing webfocus reports that I want to include a date time stamp on it. How do I do that either with code or from the report painter.
 
Reply With QuoteReport This Post
Expert
posted Hide Post
take the system date and time from your operating system.
in win2k, i use the two &vars &YYMD and &TOD
for today's date and time-of-day.
e.g.
-SET &HOUR = EDIT(&TOD,'99');
-SET &M = IF &TOD GT '12.00.00' THEN 'pm' ELSE 'am';
-SET &FLAG = IF &TOD GT '13.00.00' THEN 1 ELSE 0 ;
-SET &HOUR = IF &FLAG IS 1 THEN &HOUR - 12 ELSE &HOUR ;
-SET &MINUTES = EDIT(&TOD,'$$$99');
-SET &SECONDS = EDIT(&TOD,'$$$$$$99');
-SET &TIME = &HOUR | ':' | &MINUTES | &M;
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Platinum Member
posted Hide Post
eli,
Do you mean you just want it in your heading for information ? if so in text editor you can put the following code in your heading lines.
"&DATEtrMDYY "
"&TOD"


I wasn't sure exactly what you were asking for. If neither answer is what you were looking for maybe you could give us an example....
 
Posts: 132 | Location: Kansas | Registered: November 12, 2003Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Since this post was a couple of releases ago....is there a different way to Timestamp the time in non-military time as Susannah has done here...that does not require so many steps?


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Hi Prairie,

Try this one,
http://techsupport.informationbuilders.com/sps/83071129.html

It looks like HGETC may do the trick.

Kevin


WF 7.6.10 / WIN-AIX
 
Posts: 141 | Location: Denver, CO | Registered: December 09, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Yes...that would do it. 2 developers were trying to decide which is was more effecient... a -Set or a Define.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Reply With QuoteReport This Post
Guru
posted Hide Post
As far as effficiency goes... remember that a DEFINE is evaluated for every row of data that passes your WHERE statemements. The -SET is evaluated only once and then can be used in many places.


ttfn, kp


Access to most releases from R52x, on multiple platforms.
 
Posts: 346 | Location: Melbourne Australia | Registered: April 15, 2003Reply With QuoteReport This Post
Expert
posted Hide Post
This is what I do:

-*-- Set friendly Report Date for footing --------------------------------------
-SET &RUN_DATEX = CHGDAT('YYMD', 'MXDYY', &YYMD, 'A17');
-SET &RUN_DATE = LCWORD(&RUN_DATEX.LENGTH, &RUN_DATEX, 'A17');
-SET &RUN_TIME = HHMMSS('A8');


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
.... or for the date component -

-SET &Run_Date = &DATEtMDYY;

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5659 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I was hoping IBI had something that was non-military time function....


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
Hi Prarie,

When you say non-military, do you mean taking the time zone of the machine? If so there is an article by John Gray that uses reg.exe in a windows based system here in the Focus on Developers pages. This article also references the Zulu Time article by Susannah and both make excellent reading.

I have taken John's suggestion and produced a fex that you can include to obtain an offset -

-* system call to write the registry value to a file
! REG QUERY HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\TIMEZONEINFORMATION /V ACTIVETIMEBIAS > TZ.TXT
-*(above must be on one line)
-* filedef the file generated so that it can be read using a -READ
APP FI TZ DISK TZ.MAS
-RUN
-WRITE TZ
-WRITE TZ FILE=TZ,SUFFIX=FIX
-WRITE TZ SEGNAME=SEG1
-WRITE TZ FIELD=DATA_KEY,,A80,A80,$
-WRITE TZ DEFINE HEX/A10 = RJUST(10,GETTOK(DATA_KEY, 128, -1, 'x', 10, 'A10'),'A10');
-WRITE TZ DEFINE HEX1A/A3 = EDIT(HEX,'$$$$$$$9$$');
-WRITE TZ DEFINE HEX2A/A3 = EDIT(HEX,'$$$$$$$$9$');
-WRITE TZ DEFINE HEX3A/A3 = EDIT(HEX,'$$$$$$$$$9');
-WRITE TZ DEFINE HEX1/I3 = IF HEX1A EQ ' ' THEN 0 ELSE IF HEX1A FROM '0' TO '9' THEN BYTVAL(HEX1A, 'I3') - 48 ELSE BYTVAL(HEX1A, 'I3') - 87 ;
-WRITE TZ DEFINE HEX2/I3 = IF HEX2A EQ ' ' THEN 0 ELSE IF HEX2A FROM '0' TO '9' THEN BYTVAL(HEX2A, 'I3') - 48 ELSE BYTVAL(HEX2A, 'I3') - 87 ;
-WRITE TZ DEFINE HEX3/I3 = IF HEX3A EQ ' ' THEN 0 ELSE IF HEX3A FROM '0' TO '9' THEN BYTVAL(HEX3A, 'I3') - 48 ELSE BYTVAL(HEX3A, 'I3') - 87 ;
-RUN
FILEDEF TZ DISK ./TZ.TXT (LRECL 80 RECFM V
-RUN

TABLE FILE TZ
PRINT COMPUTE MyOffset/D5 = ( -4096 * (HEX CONTAINS 'fffff')) + ((HEX1 * 256) + (HEX2 * 16) + HEX3);
WHERE DATA_KEY CONTAINS 'ACTIVETIMEBIAS'
ON TABLE SAVE AS HEXVALUE
END
-RUN
-* read the saved data that contains the required value
-READ HEXVALUE &Offset.A5.
-RUN


and used it in another fex using Susannah's suggestion within a reuseable function -

-SET &Time = EDIT(&TOD,'99$99');
-INCLUDE TimeZone
-SET &OFFSETHOURS =-(&Offset/60);
DEFINE FUNCTION ZULUTIME(OFFSET/A10, VALUE/D4)
NOWDATETIME_A/HYYMDS=HGETC(8, 'HYYMDS');
NOWDATETIME/HYYMDS=HADD(NOWDATETIME_A, OFFSET, VALUE, 8, 'HYYMDS');
DAYSDIFF/D8=DATEDIF('19700101', '&YYMD', 'D');
MSDIFF/D32=DAYSDIFF*24*60*60*1000;
ADDOFFSET/D12=&OFFSETHOURS*60*60*1000;
NOWMILLISEC/D12 = HTIME(8, NOWDATETIME, 'D12.2');
NEEDTOADD/D13=NOWMILLISEC+ADDOFFSET+MSDIFF;
ZULUTIME/A17=FTOA(NEEDTOADD, '(D13c)', 'A17');
END
-RUN

-SET &NextRunTime='0000000000000000000' | ZULUTIME('minute',-110);


which I use to update the BOTSCHED file as necessary.

Hope this helps.

T

p.s. I know this is a wide posting but I have left it like this purposefully so that the -write lines are not split.



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5659 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Member
posted Hide Post
Based on my reading of the request, it would seem Prairie wants a value like:

YYYY/MM/DD HH:MM:SSAP

where YYYY is the year; MM is the month; DD is the day; HH is the hour; MM is the minute; SS is the second; and AP is 'AM' or 'PM'.

Assuming that is what's wanted, you can use a DEFINE with the appropriate format. If you don't reference any database fields, it is only evaluated ONCE. You can see this with a '? DEFINE', which shows that the define is NOT associated with any segment (it's global).

If you want it via Dialogue Manager, you can also get it. The first thing you need to understand, is that EVERY field stored as a Dialogue Manager value, is stored as a character string. That's why you have to work to get decimals from a calculation, as we don't know HOW MANY decimal places to keep.

So, with that said, here's how I did it:

-SET &NOW = HCNVRT(HGETC(8,'HYYMDm'),'(HYYMDSA)',30,'A30');


This is actually a subroutine call as an argument to another subroutine call. The HGETC retrieved the current date-time, as a DATE-TIME formatted field. We provide that as the FIRST argument to the HCNVRT routine, which converts a date-time field to an alpha (required by D.M. remember?).

The current time is retrieved to milliseconds, then converted to a display format with the time indicated by an AM or PM.

Hope that's what you were looking for.
 
Posts: 25 | Location: 2 Penn Plaza 28 fl | Registered: March 27, 2003Reply With QuoteReport This Post
Expert
posted Hide Post
sweet!
and loaded with ancillary info.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
<RickW>
posted
Here's the DEFINE for time - although the DM version is more flexible.

DEFINE FILE CAR
CURRTIME/HHISA= HGETC(8,'HHISA');
END
TABLE FILE CAR
" <CURRTIME "
PRINT CAR
END
 
Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Thanks to everyone...
Focwizard...
-SET &NOW = HCNVRT(HGETC(8,'HYYMDm'),'(HYYMDSA)',30,'A30');

That's it!!

Winky


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Timestamp in webfocus reports

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.