Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     how to substract 24 hr from system day

Read-Only Read-Only Topic
Go
Search
Notify
Tools
how to substract 24 hr from system day
 Login/Join
 
Gold member
posted
Hello,

I need to get records for last 24 hours.
I think I need to add time stamp to my parameter value(&NSDAT) and substract 1 day (to be exact 24 hr). Not sure how to do this.In my query I need to filter on ZZSHIP_DATE field which is A8 Please help.
Here are my parameter:
-DEFAULT &SDAT='&YYMD.EVAL', &EDAT='&YYMD.EVAL';
-SET &NSDAT=AYMD(&EDAT,-1,'I8'); (returned value is 20080227)

Thanks


Valeriya

WebFOCUS 764 Servlet - MRE/Dashboard/Self Service/ReportCaster - Windows 2000
 
Posts: 68 | Location: Chicago | Registered: August 23, 2007Report This Post
Virtuoso
posted Hide Post
Here is an example of subtracting a day from a date stamp. Do some research on HADD for more help.

WDATE1/HYYMDI = HADD(WKEND_DATE,'DAY',-1,8,WDATE1);


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Expert
posted Hide Post
Lera,
do you just need to know how to get the current system time?
&TOD will give you time, in addition to &YYMD which you're already using for the date.
These two together can be input to various Date-Time functions, such as HINPUT for converting an alpha string into a date-time value, then performing your addition/subtraction as Prarie has suggested. See the Using Functions manual beginning page 185.
Is that what you needed to know?

..
TOD stands for TimeOfDay, but you figured that out, I'm sure.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
Interesting that this post came up since I just had to use this yesterday for the first time in a long while. You've already been given an example for subtracting the day. Now you need to compare a date-time to an alpha field.
You can redefine the alpha date to a date-time value or you can convert the dat-time variable to an alpha. by far the most efficient thing to do would be to convert your &variable to the format of your real field (the alpha data ZZSHIP_DATE). Comparison against a defined field is highly inefficient.

Here's my suggestion - Forget about the time stamp and hour stuff. Get today's date and just subtract one day:

-SET &NSDATE = DATEADD(&YYMD, 'D', -1);

This gives you a value of 20080226. You can then use this directly in your WHERE clause:

WHERE ZZSHIP_DATE GE '&NSDAT.EVAL'


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Gold member
posted Hide Post
Yes, I've done that already! But I need to make sure I'm not loosing records starting at 16:00 yesterday. My program will be executed @ 4:00pm(16:00) every day, and I need all data for alst 24 hr(everything from yesterday 4:00 pm)

if I just use - 'D', -1 what is the start poind of yesterday?


Valeriya

WebFOCUS 764 Servlet - MRE/Dashboard/Self Service/ReportCaster - Windows 2000
 
Posts: 68 | Location: Chicago | Registered: August 23, 2007Report This Post
Gold member
posted Hide Post
quote:
Originally posted by susannah:
Lera,
do you just need to know how to get the current system time?
&TOD will give you time, in addition to &YYMD which you're already using for the date.
These two together can be input to various Date-Time functions, such as HINPUT for converting an alpha string into a date-time value, then performing your addition/subtraction as Prarie has suggested. See the Using Functions manual beginning page 185.
Is that what you needed to know?

..
TOD stands for TimeOfDay, but you figured that out, I'm sure.


I need to make sure I'm getting records starting at 16:00 yesterday. My program will be executed @ 4:00pm(16:00) every day, and I need all data for last 24 hr(everything from yesterday 4:00 pm) So I need to substract somehow 24 hours from current day and time(hours and minutes only)


Valeriya

WebFOCUS 764 Servlet - MRE/Dashboard/Self Service/ReportCaster - Windows 2000
 
Posts: 68 | Location: Chicago | Registered: August 23, 2007Report This Post
Virtuoso
posted Hide Post
Your field for filtering is only an Alpha 8 so there is nothing to compare to except the day - regardless of when you run the report. If you were to time-date stamp the ship field instead of only date stamp, you could do some additional processing.

The start point of the day is always 12:00AM - the day begins at midnight. So anything that happened during the ENTIRE previous day would pass your filter.

You can subtract 24 hours from right now (Today @ 4PM), but you've got nothing to compare that value against. If you ONLY want to get records starting from 4PM yesterday, you're going to have to include some sort of time stamp on the record itself - a simple A8 field won't do it. I don't think there's a way around that one.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
TOD is important to you, so just subtracting 1 day won't do.
Do you have a timestamp in the database , along with the Date field/A8?? I've seen db's in which the two are kept in separate fields.
You should have what you need now, using &TOD along with &YYMD, and have you downloaded the Using Functions manual?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Gold member
posted Hide Post
Yes,subtracting 1 day won't work. I have two fields in a table that I think I need to filter on: ZZSHIP_DATE (A8) and ERZET(A6)- TIME.
So,I'm not sure how to use all those date/time functions but I need from current date and time substract 24 hr. If you know syntex, please give me a sample.


Valeriya

WebFOCUS 764 Servlet - MRE/Dashboard/Self Service/ReportCaster - Windows 2000
 
Posts: 68 | Location: Chicago | Registered: August 23, 2007Report This Post
Expert
posted Hide Post
You can keep the date and time separate, subtract 1 from the day and then use BOTH fields to do the comparison against current date and &TOD.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Expert
posted Hide Post
Lera, just download that Using Functions manual and look at the chapter on Dates. the examples are very good and quite clear.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Gold member
posted Hide Post
THANK YOU.


Valeriya

WebFOCUS 764 Servlet - MRE/Dashboard/Self Service/ReportCaster - Windows 2000
 
Posts: 68 | Location: Chicago | Registered: August 23, 2007Report This Post
Virtuoso
posted Hide Post
There you go - you can compare ZZSHIP_DATE to your variable calculated from &YYMD and compare ERZET to your calculation from &TOD.

Default format for &TOD is HH.MM.SS so you'll probably have to edit out the periods to be able to compare against an A6 time field.

The Using Funtions manual (especially the Date and Time section) is the most used manual on my shelf. Good luck


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Gold member
posted Hide Post
THANK YOU, DARIN


Valeriya

WebFOCUS 764 Servlet - MRE/Dashboard/Self Service/ReportCaster - Windows 2000
 
Posts: 68 | Location: Chicago | Registered: August 23, 2007Report This Post
Virtuoso
posted Hide Post
Lera

if the basic manual is not giving you the proper answers I can recommend the book

"Almost 1001 Ways to work with DATES in WebFOCUS"
You can order it at Information Builders, (or via Bol.com)




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Platinum Member
posted Hide Post
if I am not mistaken &tod will be the time you enetred the session and not the current time.. for current time would it not be better to use HHMMSS?

IN A DEFINE...
TIME/A8=HHMMSS(TIME,'A8');

IRA
wf 538 aix 533


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0
 
Posts: 195 | Registered: October 27, 2006Report This Post
Gold member
posted Hide Post
thank you


Valeriya

WebFOCUS 764 Servlet - MRE/Dashboard/Self Service/ReportCaster - Windows 2000
 
Posts: 68 | Location: Chicago | Registered: August 23, 2007Report This Post
Virtuoso
posted Hide Post
&TOD is the system time at the moment you execute the request on the server.

You're going to get the same value regardless of which you use. HHMMSS is a function so you have to remember parameters. &TOD is easier and you don't have to remember parameters.
Anything I don't have to remember is easier for me! Smiler


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     how to substract 24 hr from system day

Copyright © 1996-2020 Information Builders