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.
I have a report which i am trying to calculate the total number events for the current week. The end user wants to be able to just put one input date from the front end and it will calculate the week for that date the end user put in. For example, if the end user put in 03/04/09 i need to calculate all the # of events from 03/01/09 to 03/07/09. The end user wants the dates for the week to be from Sunday to Saturday.
Can someone please help me figure out this calculation?
Also, I need to figure out the previous week as well and the current month and current year.
Please Help!This message has been edited. Last edited by: prodrigu,
Please do your homework, look into Standard Date Functions, "DATEMOV" in particular: "Moving a Date to a Significant Point".
EOM is the end of month. BOM is the beginning of month. EOQ is the end of quarter. BOQ is the beginning of quarter. EOY is the end of year. BOY is the beginning of year. EOW is the end of week. BOW is the beginning of week. NWD is the next weekday. NBD is the next business day. PWD is the prior weekday. PBD is the prior business day. WD- is a weekday or earlier. BD- is a business day or earlier. WD+ is a weekday or later. BD+ is a business day or later.
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
You can also use the following in DM.. this will take a param called INPUT_DATE and calculate the previous sun to next sat.
Jodye
-SET &INPUT_DATE='20090317';
-SET &DOW=DOWK(&INPUT_DATE, 'A4');
-SET &LASDIFF = IF &DOW EQ 'SUN' THEN 0
-ELSE IF &DOW EQ 'MON' THEN -1
-ELSE IF &DOW EQ 'TUE' THEN -2
-ELSE IF &DOW EQ 'WED' THEN -3
-ELSE IF &DOW EQ 'THU' THEN -4
-ELSE IF &DOW EQ 'FRI' THEN -5
-ELSE IF &DOW EQ 'SAT' THEN -6;
-SET &LASTSUN = AYMD(&INPUT_DATE, &LASDIFF ,'I8');
-*-GET THE FOLLOWING SATURDAY
-SET &NEXTSAT = AYMD(&LASTSUN, 6 ,'I8');
-TYPE &LASTSUN
-TYPE &NEXTSAT
Though I'm not sure how you get a week's date range Monday to Sunday or Sunday to Saturday without having to add/subtract to/from the BOW and EOW results. Setting BUSDAYS to SMTWTFS doesn't do it.
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
Thanks Francis you just triggered a memory. I had trouble with that a long time ago (years) and just came up with the code I posted... which works perfectly and lets you easily define the week. Nice when you look at some old code and think "why did I do it like that?". If only there was time for line by line documentation inside the fex.
that is why I like reading this forum... I often find a better (read more efficient) way to do something that is already working.
I used your code above and below is the output I am getting. How can I set the beginning of the week to Sunday and the end to Saturday? So the dates should be from 20090315 to 20090321.
Thanks Francis for all your help. The code you gave me worked. Now that you showed me how to calcualte the current week, how do you go about calculating the previous week and current month and current year though? Sorry for asking so many questions.
Thanks FrankDutch about letting me know about adding .EVAL to &BOW1.
I ask because the table field name format I am using is HYYMDS. And I keep getting this error which i believe i need to convert one of the formats to the other.
(FOC36346) INCORRECT USE OF DATE-TIME FIELD OR CONSTANT
We've been led up the Dialogue Manager garden path.
You want to do this in a DEFINE or COMPUTE with a Date-Time data column? I assumed that because the user was inputting a Dialogue Manager variable which contains the date, you wanted the From and To dates in Dialogue Manager as well, to be used as filters in your program.
DEFINEs and COMPUTEs with Date-Time columns are done a little differently.
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
Yes, when I say previous week it will be the previous Saturdat to Sunday. And when I say current month I mean for this whole month. If the end user puts todays date on the front end he wants to see everything for that month. And current year follows as well if he puts in todays date it should give him everything in that current year so it should give him everything in 2009. Do i make sense or no? Let me know.
The report should look like below:
Title INPUT_DATE - input date from front end
current week: # of events previous week: # of events current month: # of events previous month: # of events current year: # of events previous year: # of events
Get Focus day-of-week number (1=Mon, ..., 6=Sat, 7=Sun) from DATECVT; Mod maps it to offset from Sunday (1,...,6,0), subtract, with AYMD, to get BOW; add 6 to get EOW.
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
Thank you for all your help. You help me figure out the current week and previous week and I figured out with your help the current month, current year but how would you figure the previous month since there are different amount of days in each month?
I figure for previous year i can do something like below: This seems to work.