|
Go
![]() |
New
![]() |
Search
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Gold member |
Hello, I'm launching my FOCEXEC files via custom HTML pages. On the page, I have a date text box - if the user doesn't fill it in, I want it to default to, say, 01/31/2001.
I tried: -DEFAULT &FromDate = '20010131'; TABLE FILE T1 COMPUTE temp/YYMD = &FromDate; AS 'From Date' .. END This always prints temp as a blank if I do not specify a date in the HTML start page. Am I doing something wrong? |
||
|
|
Platinum Member |
Hi There
Use this.. -DEFAULTS &FromDate = '20010131'; Jodye. |
|||
|
|
Gold member |
Jodye, thank you for the reply. I tried changing "DEFAULT" to "DEFAULTS" but it did not fix the problem... Any other ideas?
|
|||
|
|
Platinum Member |
Hi BIGPGO
Yes. you must disable the "prompt for parameters" flag in dev studio. Uncheck it. Then try it. I just did that for this and it works. -DEFAULTS &FromDate = '20010131'; TABLE FILE CAR MODEL COMPUTE temp/YYMD = &FromDate; AS 'From Date' END |
|||
|
|
Master |
Put the COMPUTE value in quotes:
COMPUTE temp/YYMD = '&FromDate'; ... Assignment to a date variable expects a date variable, or date variable +/- integer offset, or string constant representing a compatible date, on the RHS. |
|||
|
|
Gold member |
Thank you for the replies. I put the COMPUTE field on quotes, however, I'm not using dev studio (I'm on webFOCUS 4.x), so I dont know where to disable the prompt for parameters flag (also, I still want some other parameters to be prompted for - fromDate is not the only user-input field). I guess I'll just use a trick that I found (do a manual assigment of the variable if it equals a '' date)
|
|||
|
|
Platinum Member |
Hi
You mean -SET &FromDate = IF &FromDate ='' THEN '20010131' ELSE &FromDate; Yes that will work. If you are not using dev studio, I am not sure where to disable the prompt for params. That's a good question. We always turn off the prompt for params. We don't need that since we are always submitting via ASP pages, so we have total control over all of the params that are submitted. OK Back to work... Jodye |
|||
|
| <WFUser>
|
Your code works fine in version 5.x. Could be version 4 was picky about the syntax. Try removing the ampersand and semicolon from the -DEFAULT.
-DEFAULT FromDate = '20010131' |
||
|
|
Guru |
Since you are using version 4 I believe it does not like mixed case variables and the semicolon in the -DEFAULT statement.
Try something like this: -DEFAULT &FROMDATE = '20010131' |
|||
|
|
Gold member |
Thank you all for the replies. I got it to work using this:
-DEFAULT &FromDate = '20010131'; -SET &FromDate = IF &FromDate EQ '' THEN '20010131' ELSE &FromDate; //the rest as before I guess saying "default .." is not enough - you then have to explicitely set it to that value. Thanks for the help again. |
|||
|
|
Master |
Sounds like the HTML form is explicitly setting FromDate to blanks (e.g., "?...&FromDate=&..."), thereby overriding the -DEFAULT.
Add -? & at start of the fex and see what &vars are initially set. |
|||
|
|
Master |
Yea, If &FromDate is a text box it will alway exist thus -DEFAULT will not work. Try This
-SET &FromDate = IF '&FromDate' EQ '' THEN '20010131' ELSE &FromDate; Good Luck |
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

