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     [SOLVED] Month of Current Date is blank

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Month of Current Date is blank
 Login/Join
 
Master
posted
testing wf8206.

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
END

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Master
posted Hide Post
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


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Virtuoso
posted Hide Post
Robert

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, 2005Report This Post
Virtuoso
posted Hide Post
Or try this:
  
CURRDT/YYMD=DT_CURRENT_DATE();
CURR_MNT/M=CURRDT;


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Platinum Member
posted Hide Post
You could set a variable:

-SET &Roll07 = IF &DATEM EQ 7 THEN 'OR -2' ELSE ' ';

Then in your WHERE statement:

WHERE TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.ROLLINGMONTHS EQ 0 OR -1 &Roll07;

You can use this set statement at the beginning of your procedure for testing:

 SET TESTDATE=20190701
-RUN


WebFOCUS 8.2.06
 
Posts: 210 | Location: Sterling Heights, Michigan | Registered: October 19, 2010Report This Post
Guru
posted Hide Post
You need to truncate the date first:

 
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
 


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Guru
posted Hide Post
And the date selection can be done like this:

 
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
 


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Gold member
posted Hide Post
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 ;


IBI Development
 
Posts: 61 | Registered: November 15, 2005Report This Post
Guru
posted Hide Post
Good one about &DATEM, why is this parameter not listed if you do

-? &


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Master
posted Hide Post
quote:
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, 2006Report 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     [SOLVED] Month of Current Date is blank

Copyright © 1996-2020 Information Builders