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] Setting Start Values in Calendar Controls

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Setting Start Values in Calendar Controls
 Login/Join
 
Gold member
posted
I'm having a hard time setting the initial values for a Start and End date set of calendar controls. Start date needs to be a year before today, so it's computed. The only way to get a value into the control is by using a fex from the Requests zone and you would think that this would be easy. First of, as an aside, I don't see why a fex should be necessary. Why should I have to connect to a database just to set a couple of constants?

Currently my fex looks like this, although this has been evolving:

TABLE FILE CMSBESTPRACTICESDATA
SUM
COMPUTE ONEYEARAGO/MDYY = DTADD( '&YYMD', YEAR, -1 );
COMPUTE CURRENTDATE/MDYY = '&YYMD';
BY HIGHEST 1 SCHED_START_DT
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
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,
$
ENDSTYLE
END

Please don't tell me that I can set the current date part by checking the box in Settings. I know this. That isn't the problem.

This message has been edited. Last edited by: mbondr,


WebFOCUS 8.2.04 (and climbing)
Windows 10, AppStudio
 
Posts: 84 | Registered: February 08, 2018Report This Post
Guru
posted Hide Post
You can use javascript in your HTML page. Here's some that I stole and modified.

Use this in a WebFocus HTML Launch page if you need to default a calendar control to the first
or last day of the current month. substitute your control names for "cal_StartDate" and "cal_EndDate".

if(typeof(bRuntime) != 'undefined') {
// TODO: Add your inline runtime code here
}
//Begin function window_onload
function window_onload() {
UpdateData();
// TODO: Add your event handler code here
//
// This gets today's date into mm/dd/yyyy format
var today = new Date();
var mm = today.getMonth() + 1;
var dd = '01';
var yyyy = today.getFullYear ();
if (mm < 10)
{mm = '0' + mm};
var beginningOfMonth = mm + '/01/' + yyyy;
document.getElementById("cal_StartDate").value = beginningOfMonth;
var d = new Date();
m = d.getMonth(); //current month
y = d.getFullYear(); //current year
var lastday = new Date(y,m+1,0); //this is last day of current month
//break it up so we can show it in mm/dd/yyyy format
var lastmm = lastday.getMonth() + 1;
if (lastmm < 10)
{lastmm = '0' + lastmm};
var lastdd = lastday.getDate ();
var lastyyyy = lastday.getFullYear ();
var endOfMonth = lastmm + '/' + lastdd + '/' + lastyyyy;
document.getElementById("cal_EndDate").value = endOfMonth;
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload 


Webfocus 8
Windows, Linux
 
Posts: 258 | Location: Palm Coast, FL | Registered: February 05, 2010Report This Post
Virtuoso
posted Hide Post
Fex to set the default dates
No need to have all these ON TABLE... and the output format must be XML
TABLE FILE CAR
SUM COMPUTE ONEYEARAGO /YYMD = DTADD(DT_CURRENT_DATE(), YEAR, -1);
    COMPUTE CURRENTDATE/YYMD = DT_CURRENT_DATE();
BY COUNTRY NOPRINT
WHERE READLIMIT   EQ 1;
WHERE RECORDLIMIT EQ 1;
ON TABLE PCHOLD FORMAT XML
END 
-RUN

Then add this fex as a Request & Data Source within your HTML
Associate the fex in the Settings of your Start calendar control as an Explicit (Request panel) and have the ONEYEARAGO in the "Value From" & "Display From"
Do the same for your End calendar control but with the CURRENTDATE in the "Value From" & "Display From"
Adjust both calendar range and other settings as you whish.

Other options may be available to set the default values, but depending on how your HTML is accessed, the options differ.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Gold member
posted Hide Post
Yay! Both techniques clearly laid out. I will make sure these are saved. Thanks!


WebFOCUS 8.2.04 (and climbing)
Windows 10, AppStudio
 
Posts: 84 | Registered: February 08, 2018Report 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] Setting Start Values in Calendar Controls

Copyright © 1996-2020 Information Builders