Focal Point
[CLOSED] Passing Date Param with pull down menu instead of text box.

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8737087395

November 16, 2010, 02:30 PM
Greg
[CLOSED] Passing Date Param with pull down menu instead of text box.
Right now I have a check register report that prompts for a parameter called CDATE.

The Date is entered like this "2008/01/13" into a text box. The date must match the check run date exactly.
This is fine for our internal users as they know the format and the date of the last check run.

We are now wanting to put this report the web.
The web users will not know the format or the check run date.

I would like to present them with two pulldown menus:

-= Select Year =-
2008
2009
2010
All

-=Select Month=-
Jan
Feb
Mar
Apr
May
etc
ALL

I would like to chain these together so if they choose ALL in the year field, the month param is disabled.

It needs to be able to pass a * for the day always, and a * for the month is one is not chosen.

Is this possible? Can I break a date param in to two pulldowns and pass a * ?

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


prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL

November 18, 2010, 08:18 AM
GamP
quote:
The web users will not know the format or the check run date
Any reason why you would not tell them (in a small addition to the prompt perhaps) what the format of the variable should be? By doing that you would not have to split the variables up.
quote:
Can I break a date param in to two pulldowns and pass a * ?
The simple answer to this is Yes, we can. The more complex answer depends on how you want to get the value from the user (ie. using autoprompt or using html composer or using a self made html file, or ...)


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
November 18, 2010, 08:56 AM
Tony A
quote:
The Date is entered like this "2008/01/13" into a text box. The date must match the check run date exactly.

You can use JavaScript masking to ensure that the input is precisely as you need it to be.

Search JavaScript forums for suitable date validation routines.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
November 18, 2010, 10:04 AM
Greg
quote:
Originally posted by GamP:
quote:
The web users will not know the format or the check run date
Any reason why you would not tell them (in a small addition to the prompt perhaps) what the format of the variable should be? By doing that you would not have to split the variables up.
quote:
Can I break a date param in to two pulldowns and pass a * ?
The simple answer to this is Yes, we can. The more complex answer depends on how you want to get the value from the user (ie. using autoprompt or using html composer or using a self made html file, or ...)


Right now if you enter a day that there was not check run you get the standard no html output error. We want to offer our web users just year and month. They can choose 2009 - Jan and see the 4 runs for that month. Or 2009 - All and see the runs for the entire year.

The report was made with the report painter in developer studio. I just did a right click publish. I can then edit and add the pulldown/javascript or whatever else in Dreamweaver.

If I use the HTML composer the report will require a password to run.

I just want to add the pulldowns to make it more user friendly.

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


prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL

November 18, 2010, 01:16 PM
Tony A
Greg,

Please check your PM inbox for an important message from Kerry

To whet your appetite, here is a piece of JavaScript that I put together a while ago for validating date inputs. It validates to the format DD/MM/YYYY as it was for a UK application, but with care you should be able to refine it for your purposes.

function validate_date(ctrl) {
  var Array_days_in_month = new Array(0,31,29,31,30,31,30,31,31,30,31,30,31);
  this.dateObj = document.getElementById(ctrl);
  chkdate = this.dateObj.value;
//  alert("Checking date for "+ctrl+" - "+chkdate)
  if (chkdate != null  && chkdate != '') {
    if (!chkdate.match(/^[0-3]{1}[0-9]{1}[/]{1}[0-1]{1}[0-9]{1}[/]{1}[0-9]{4}$/)) {
      alert("The date MUST be in dd/mm/yyyy format\nand a valid date.\n\nYou entered - "+chkdate);
      this.dateObj.focus();
      this.dateObj.select();
      return false;
    } else {
// The date is valid in format but is it a valid date?
// Split the date components to validate days in month and month number
      chk_days = chkdate.substring(0,2) * 1;
      chk_mnth = chkdate.substring(3,5) * 1;
      chk_year = chkdate.substring(6,10) * 1;
      days_in_mnth = Array_days_in_month[chk_mnth];
//        alert("Days - "+chk_days+"\nMonth - "+chk_mnth+" - "+days_in_mnth+"\nYear - "+chk_year);
      if (chk_mnth < 1 || chk_mnth > 12 || chk_days < 0 || chk_days > days_in_mnth || days_in_mnth == null || days_in_mnth == " ") {
        alert("Format OK, but the date MUST be valid.\n\nYou entered - "+chkdate);
        this.dateObj.focus();
        this.dateObj.select();
        return false;
      }
    }
  }
}

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
November 18, 2010, 01:29 PM
GamP
quote:
We want to offer our web users just year and month. They can choose 2009 - Jan and see the 4 runs for that month. Or 2009 - All and see the runs for the entire year.
But then you would have to re-structure your request, because you can't do an equal test anymore. You would have to code a from-to or ge and le where. And indicate in the request which date it concerns, or first create an overview of all available dates with a drilldown and then when the drilldown is clicked show the detail report for the selected date.
It can be done of course, but one thing is easier then the other. And I can't make that decision for you.
I'll see if I can come up with something.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
November 18, 2010, 01:41 PM
Greg
I like the drill down Idea. Because I can make a request with the cdate param blank and get all the runs since 2008 when our finance system went online.


prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL

November 19, 2010, 08:37 AM
PBrightwell
If you are doing this from an HTM screen, why not put the year and month together and offer a multi-select option?


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes