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     [SOLVED] Month of Current Date is blank
Go
New
Search
Notify
Tools
Reply
  
[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 8.
Windows, All Outputs
 
Posts: 544 | Registered: June 28, 2013Reply With QuoteReport 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 8.
Windows, All Outputs
 
Posts: 544 | Registered: June 28, 2013Reply With QuoteReport 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: 1694 | Location: Customer Support | Registered: April 12, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Or try this:
  
CURRDT/YYMD=DT_CURRENT_DATE();
CURR_MNT/M=CURRDT;


WebFOCUS 8206, Unix, Windows
 
Posts: 1716 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport 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


WF 8.2.06
Win10 / IE11
AHTML EXL2K PDF
 
Posts: 141 | Registered: October 19, 2010Reply With QuoteReport 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: 411 | Location: Europe | Registered: February 05, 2007Reply With QuoteReport 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: 411 | Location: Europe | Registered: February 05, 2007Reply With QuoteReport 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: 59 | Registered: November 15, 2005Reply With QuoteReport 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: 411 | Location: Europe | Registered: February 05, 2007Reply With QuoteReport 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: 942 | Location: Oklahoma City | Registered: October 27, 2006Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Month of Current Date is blank

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