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     How to set default values for user input parameter

Read-Only Read-Only Topic
Go
Search
Notify
Tools
How to set default values for user input parameter
 Login/Join
 
<bigpgo>
posted
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
PRINT
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?
 
Report This Post
Platinum Member
posted Hide Post
Hi There

Use this..

-DEFAULTS &FromDate = '20010131';

Jodye.
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
<bigpgo>
posted
Jodye, thank you for the reply. I tried changing "DEFAULT" to "DEFAULTS" but it did not fix the problem... Any other ideas?
 
Report This Post
Platinum Member
posted Hide Post
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
PRINT
MODEL
COMPUTE temp/YYMD = &FromDate; AS 'From Date'
END
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Virtuoso
posted Hide Post
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.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
<bigpgo>
posted
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)
 
Report This Post
Platinum Member
posted Hide Post
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
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
<WFUser>
posted
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'
 
Report This Post
Guru
posted Hide Post
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'
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Report This Post
<bigpgo>
posted
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.
 
Report This Post
Virtuoso
posted Hide Post
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.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Master
posted Hide Post
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
 
Posts: 865 | Registered: May 24, 2004Report 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     How to set default values for user input parameter

Copyright © 1996-2020 Information Builders