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.
Essentially I need to evaluate today's date and if July (7/07??) then set a variable to TRUE otherwise FALSE.
I was able to find a function to return the current date's month. See Below. The trouble is that when I run my fex...it is always blank.
Ideas?
After that works, I must somehow code my where to say, in English..if I'm in July (CURMTH=7)then select rollingmonths = 0 or -1 or -2 otherwise just select rollingmonths = 0 or -1.
-* Get Month of Current Date DEFINE FILE TBLMSTR_CALENDARPERIOD CURMTH/M=DT_CURRENT_DATE(); END
TABLE FILE TBLMSTR_CALENDARPERIOD BY LOWEST TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.FISCALYEAR BY LOWEST TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.PERIOD BY LOWEST TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.PERIODTEXT BY CURMTH -* Eventually change WHERE below: In August Pull Rolling Months 0, -1, -2 -* Otherwise only pull RollingMonths 0, -1 WHERE TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.ROLLINGMONTHS EQ 0 OR -1; ON TABLE SET PAGE-NUM NOLEAD ON TABLE SET ASNAMES ON ON TABLE NOTOTAL ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLEMBEDIMG ON ON TABLE SET HTMLCSS ON ENDThis message has been edited. Last edited by: FP Mod Chuck,
so here is where I am at...but the darn CURMTH is always blank! (and I know I am using Oct (10) for testing--it should be 07..just want to make sure it works)
-* Get Month of Current Date DEFINE FILE TBLMSTR_CALENDARPERIOD CURMTH/M=DT_CURRENT_DATE(); FLAG/A1=IF CURMTH EQ '10' THEN 'T' ELSE 'F'; END TABLE FILE TBLMSTR_CALENDARPERIOD BY LOWEST TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.FISCALYEAR BY LOWEST TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.PERIOD BY LOWEST TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.PERIODTEXT BY LOWEST CURMTH BY FLAG
-IF FLAG = 'T' THEN GOTO JULYWHERE ELSE GOTO OTHERWHERE;
-JULYWHERE WHERE TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.ROLLINGYEARS EQ 1 OR 0 OR -1; -GOTO CONTINUE
-OTHERWHERE WHERE TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.ROLLINGYEARS EQ 0 OR -1;
-CONTINUE ON TABLE SET PAGE-NUM NOLEAD ON TABLE SET ASNAMES ON ON TABLE NOTOTAL ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLEMBEDIMG ON ON TABLE SET HTMLCSS ON END
Since you date table seems to be having an issue how about trying this. -SET &MONTH=EDIT(&YYMD,'$$$$99'); DEFINE FILE TBLMSTR_CALENDARPERIOD CURMTH/I2=&MONTH; FLAG/A1=IF CURMTH EQ '10' THEN 'T' ELSE 'F'; END This message has been edited. Last edited by: FP Mod Chuck,
Thank you for using Focal Point!
Chuck Wolff - Focal Point Moderator WebFOCUS 7x and 8x, Windows, Linux All output Formats
Posts: 2127 | Location: Customer Support | Registered: April 12, 2005
DEFINE FILE CAR
CURMTH/M=DTRUNC(DT_CURRENT_DATE(),MONTH);
END
TABLE FILE CAR
BY LOWEST COUNTRY
BY LOWEST MODEL
BY LOWEST SEATS
BY CURMTH
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
END
DEFINE FILE CAR
CURMTH/M=DTRUNC(DT_CURRENT_DATE(),MONTH);
STARTMONTH/I1=IF CURMTH EQ 7 THEN -2 ELSE -1;
END
TABLE FILE CAR
BY LOWEST COUNTRY
BY LOWEST MODEL
BY LOWEST SEATS
BY CURMTH
BY STARTMONTH
-* SEATS will be the ROLLINGMONTHS, in your case the value will be 0
WHERE SEATS LE 5
WHERE SEATS GE STARTMONTH
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
END
Just to clarify, it's important to remember the difference between new dates and datetimes. For instance, the function DT_CURRENT_DATE returns a *datetime* not a newdate. So, normally one would code:
MYDTIME/HYYMDS = DT_CURRENT_DATE();
To obtain the datetime, and then
MYMON/M = MYDTIME;
to get the *newdate* (M). Also, remember that automatic conversion from a datetime to a newdate is relatively new, starting with 7.7.6. Before this, one would need a datetime function to get the month value directly from a datetime. Also, two steps are needed to get the newdate (M) from a datetime: the following (currently) does not work:
MYMON/M = DT_CURRENT_DATE();
Now, as noted by others here, *unless you really need a datetime* you should not use DT_CURRENT_DATE(). The simplest way to get the current month is to just use the system variable &DATEM:
MYMON/M = &DATEM;
In the old days, &DATEM did not exist, and so one would code:
MYTODAY/YYMD = &YYMD; MYTODM/M WITH COUNTRY = MYTODAY ;
Finally, remember that the M newdate is not really a date but rather a date component. It's just that the expression compiler knows how to extract date components without calling a subroutine:
MYTODAY/YYMD = &YYMD ; MYTODD/D WITH COUNTRY = MYTODAY ; MYTODM/M WITH COUNTRY = MYTODAY ; MYTODY/YY WITH COUNTRY = MYTODAY ;
Originally posted by Frans: Good one about &DATEM, why is this parameter not listed if you do
-? &
Probably because you can put any valid date format after &DATE, i.e. &DATEY, &DATEYY, &DATED, &DATEMDYY, &DATEYYMD, &DATEMtRDYY, &DATEMtDYY, &DATEMTrDYY, &DATEW, &DATEQ, etc.This message has been edited. Last edited by: jgelona,
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006