Focal Point
[Solved] Force a PROMPT or Set -DEFAULT to a Variable

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

February 18, 2016, 12:46 PM
Kevin Patterson
[Solved] Force a PROMPT or Set -DEFAULT to a Variable
I would like to set a parameter to a value that is stored in another parameter and still prompt for that parameter. For instance I want to ask the user what fiscal year they would like to view, but already have the field populated with the current fiscal year.

And I would like to do it with out having to create an HTML launch page.

Here is what I think should work:

-SET &Fiscal_Year_Prompt=&Fiscal_Year_Calculated_Already;
-PROMPT '&Fiscal_Year_Prompt.Enter the fiscal year.';

The fex seems to ignore the -PROMPT command because the value of that parameter is already set.

I cannot manage to use -DEFAULT either. The fex will not evaluate the parameter I am trying to default it to:
-DEFAULT &Fiscal_Year_Prompt='&Fiscal_Year_Calculated_Already';
When running the fex it prompts for &Fiscal_Year_Prompt but the default value is literally these characters: '&Fiscal_Year_Calculated_Already' rather than the value of that field.

I have also tried:
-DEFAULT &Fiscal_Year_Prompt='&Fiscal_Year_Calculated_Already.EVAL';
-RUN

This message has been edited. Last edited by: Kevin Patterson,


Kevin Patterson
Appalachian State University
WebFOCUS 7.7.03
Windows, All Outputs
February 18, 2016, 02:09 PM
Doug
This looks like a case for a "launch page" / user input screen / HTMLFORM... Or, it can be done in InfoAssist with a dynamic source... Or... several other options. But -DEFAULTing to a variable isn't going to work...
February 18, 2016, 02:15 PM
BabakNYC
Autoprompt has limited functionality. Your default value is the first on the list. If you -DEFAULT the &variable you won't even get autoprompted for it anymore.


WebFOCUS 8206, Unix, Windows
February 18, 2016, 02:51 PM
Kevin Patterson
Ohhhhkay. I'll use a launch page. Roll Eyes

Thanks for the confirmation that I wasn't just messing it up.


Kevin Patterson
Appalachian State University
WebFOCUS 7.7.03
Windows, All Outputs
February 18, 2016, 07:16 PM
Vivian
Hey Kevin,

I know you closed this, but it looked like you needed to simply remove your quotation marks and then you will get the actual value of the variable and not just the variable name --
-DEFAULT &XX = &OTHERVARIABLE ;


Vivian Perlmutter
Aviter, Inc.


WebFOCUS Keysheet Rel. 8.0.2
(Almost) 1001 Ways to Work with Dates thru Rel. 8.0.2
Focus since 1982
WebFOCUS since the beginning
Vivian@aviter.com

February 19, 2016, 08:53 AM
Squatch
To further expand on Vivian's post, here's a working example:

-SET &COUNTRY_ALREADY='ENGLAND';
-DEFAULT &COUNTRY=&COUNTRY_ALREADY.EVAL;

TABLE FILE IBISAMP/CAR
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR
BY  CAR.CARREC.MODEL
WHERE CAR.ORIGIN.COUNTRY EQ '&COUNTRY';
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/endeflt.sty,
$
ENDSTYLE
END
-RUN



App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
February 19, 2016, 08:58 AM
BabakNYC
I believe he wants to set the value but still get prompted for &COUNTRY. That won't happen with this example.


WebFOCUS 8206, Unix, Windows
February 19, 2016, 09:02 AM
Squatch
quote:
Originally posted by BabakNYC:
I believe he wants to set the value but still get prompted for &COUNTRY. That won't happen with this example.


Correct. But it might still be useful somehow for him or others reading this thread in the future.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
February 19, 2016, 10:54 AM
Doug
I stand corrected... Try this:
-SET &COUNTRY_ALREADY='ENGLAND';
-DEFAULT &COUNTRY=&COUNTRY_ALREADY.EVAL;
TABLE FILE IBISAMP/CAR
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR
BY  CAR.CARREC.MODEL
WHERE CAR.ORIGIN.COUNTRY EQ '&COUNTRY';
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/endeflt.sty,$
ENDSTYLE
END
-RUN
Smiler Doug

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