Jump to content

Looking for a Date Subroutine in WebFOCUS that will create a list of calendar dates for a given month?


Thomas Foster 2

Recommended Posts

There could be a number different answers depending on the specifics of what you are trying to do. Here's one. The following code could be put in a WebFOCUS procedure (a .fex file) and when run could prompt you for a value for the variable &Month in yyyymm format. This month is 202301.

-DEFAULT &Month = 202302;-SET &Start = &Month | 01;  TABLE FILE syscolum PRINT NAME NOPRINT COMPUTE Date/YYMD = IF LAST Date EQ 0 THEN '&Start' ELSE Date + 1; COMPUTE Month/YYM = Date; NOPRINT WHERE TOTAL Month LE '&Month' WHERE RECORDLIMIT LE 31 ON TABLE SET PAGE NOLEAD END

In this example for 202302 output would be: image.thumb.png.73acb8c79123b017cc9205edb0103add.png

Link to comment
Share on other sites

Hey Thomas,

I don't know what you're going after here, but if you're looking to draw something that resembles a calendar, there are some HTML5 extensions that might be helpful like this one :

https://github.com/ibi/wf-extensions-chart/tree/master/com.ibi.calendar_traditional

Of course if you just need a list of dates - like maybe to populate a dropdown, then there are a lot of ways to do that.

Just passing this along.

Toby

Link to comment
Share on other sites

Hi Toby,

 

The requirements here for a report I am currently working on is to create a column in that report which shows all the calendar dates for a given month. This means that this column is not coming from a Database Field. It has to come from some function or sub-routine that is capable generating all the dates for a given month. All dates for the calendar month have to be represented in this column not just the dates where data occurs by a date field in the DB.

 

Thomas Foster | senior engineer ii

Enterprise Platforms

American Express

1500 NW 136th Avenue | Sunrise, FL 33323

O: 954-503-5840 | M: 248-935-4473 E: thomas.foster@aexp.com

Link to comment
Share on other sites

One of the simple technique is as following.

I've used David calendar, perform June 1994, extract employee's birth date for the same period and "merge" them

-DEFAULT &MONTH = 199406;-SET &START = &MONTH | 01; SET HOLDLIST = PRINTONLY TABLE FILE SYSCOLUMPRINT NAME NOPRINT COMPUTE DATE/YYMD = IF LAST DATE EQ 0 THEN '&START' ELSE DATE + 1; COMPUTE MONTH/YYM = DATE; NOPRINT COMPUTE NB_EMPL /I3 = 0; AS 'NB_EMPL'WHERE TOTAL MONTH LE '&MONTH';WHERE RECORDLIMIT LE 31;ON TABLE HOLD AS DTEFILEEND-RUN TABLE FILE WF_RETAILSUM CNT.DST.EMPLOYEE_NUMBER/I3 AS 'NB_EMPL'BY DATE_OF_BIRTH AS 'DATE'WHERE DATE_OF_BIRTH GE '19940601' AND DATE_OF_BIRTH LE '19940630';ON TABLE HOLD AS DATAFILEEND-RUN TABLE FILE DTEFILESUM NB_EMPLBY DATEON TABLE SET PAGE-NUM NOLEADMOREFILE DATAFILEEND-RUN

Important thing is to have same number of field, same name & same format from merged files.

You could also use the MATCH feature which gives you more flexibilities then MORE because you don't need to have same number of fields between the MATCHed files; only the fields used for the MATCH must be similar

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...