Focal Point
[CLOSED] -DEFAULT DYNAMIC VALUES

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

June 08, 2018, 10:28 AM
Les J
[CLOSED] -DEFAULT DYNAMIC VALUES
It appears that you cannot set a -DEFAULT value to an amper-variable.

-DEFAULT &START_DATE = &STARTDATE

The auto-prompt displays &STARTDATE. Anybody have a workaround. The .EVAL also does not work.

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8

Windows, All Outputs
June 08, 2018, 11:01 AM
BabakNYC
What's the value of &STARTDATE? You're setting an & with another &.


WebFOCUS 8206, Unix, Windows
June 08, 2018, 11:01 AM
Doug
TRUE: "It appears that you cannot set a -DEFAULT value to an amper-variable."

There are work-arounds...

This message has been edited. Last edited by: Doug,
June 08, 2018, 11:17 AM
Les J
It really doesn't matter what the value is but if I do..

-SET &START_DATE = 06082018 ;
-DEFAULT &STARTDATE = &START_DATE

The auto-prompt displays &START_DATE


WebFOCUS 8

Windows, All Outputs
June 08, 2018, 11:33 AM
BabakNYC
I think if you don't want the variable to prompt you have to use -DEFAULTH for hidden like this:

-SET &ECHO=ALL;
-SET &START_DATE = 06082018;
-DEFAULTH &STARTDATE = &START_DATE.EVAL;  



WebFOCUS 8206, Unix, Windows
June 08, 2018, 11:44 AM
Les J
I want it to auto-prompt.

What I have is a -INCLUDE that sets the default start date to the previous 28 days. This works for my HTML pages but the focexecs that the users create themselves who do not use HTML pages, I don't want them to have to enter the dates every time if they don't need to change those values.


WebFOCUS 8

Windows, All Outputs
June 08, 2018, 12:02 PM
Tom Flynn
Les,
Maybe this will work:
 
-SET &DATE_LESS_28 = DATECVT((DATEADD((DATECVT (&YYMD, 'I8YYMD', 'YYMD')),'D',  -28)), 'YYMD','I8YYMD');
-SET &DATE_LESS_28 = EDIT(&DATE_LESS_28,'$$$$99/99/') || EDIT(&DATE_LESS_28,'9999');
-DEFAULTS &STARTDATE = &DATE_LESS_28.EVAL
-TYPE &STARTDATE



Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
June 08, 2018, 12:15 PM
Les J
I do that -DM commands in INCLUDE and the TYPE command shows the correct value but it's the auto-prompt value that's the issue. It displays the literal variable name and not the value.


WebFOCUS 8

Windows, All Outputs
June 08, 2018, 03:38 PM
Doug
What's the properties of the "Prompt For Parameters" on the fex (Yes or No)?
June 10, 2018, 01:50 PM
j.gross
Bear in mind the order of execution: Autoprompt is triggered by a static analysis (pre-scan) of the code, before any lines (whether DM of FOCUS) in the fex are executed. At that point, none of the amper vars have actually been instantiated. In shore, Autoprompt can only assemble prompting text based on the static content of the fex file.

To overcome that you'd have to generate fex code dynamically, in which the computed values are hardcoded in the -DEFAULT statements, and then (after a -RUN) EX or -INCLUDE it (in a manner that gets by the client-side pre-scan). But I'd hestiate to venture out on that limb in a production application.

This message has been edited. Last edited by: j.gross,


- Jack Gross
WF through 8.1.05