Focal Point
[SOLVED] prompting for default value

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

February 02, 2007, 10:18 AM
FrankDutch
[SOLVED] prompting for default value
I have some default startup settings that calculate the previous month code as '20070101';

I have a report that by default should use that date but where the user must be able to overrule the prompted value.

I tried this in the startup of the program
-DEFAULT &PERIODE='&&VRG_JRMND';

But then the user gets a screen that shows the ampercode instead of the amper value
I tried also
-DEFAULT &PERIODE='&&VRG_JRMND.EVAL';

but that did not work either.

What is the solution?

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




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 02, 2007, 10:24 AM
mgrackin
Remove the single quotes.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
February 02, 2007, 10:29 AM
FrankDutch
Mickey...

if it was that symple!

but no result here.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 02, 2007, 10:57 AM
TexasStingray
quote:
FrankDutch



If you want to prompt the user for a variable value say VRG_JRMND and then want to assign it to a variable called PERIODE then this code might help.

-DEFAULT &VRG_JRMND='somevalue';
-SET &PERIODE = &VRG_JRMND;


Scott




Scott

Frank, Tex is right, you can't DEFAULT one &var with the value of another &var.
tant pis.
so, you must create a new variable with -SET which accepts the incoming value of the DEFAULTed var, and proceed to make all your decisions from that second var.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Susannah, Tex

I'm sorry but that's not the point.

I want to show the precalculated value of the amper variable to the user and the user must have the opportunity to overrule that value

So when the program runs this month the prompt show '20070101' and the user might change that in 20061201 or 20050501.
Next month (march) the program automatically show '20070201' and either the user hits run and the program uses that value or again the user over wrights that value to '20060301'.

What Tex suggests is easy to do, but that "somevalue" is static and I want that value variable.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

In that case you need to do something with javascript. I have several launch pages at a customer site that set a Default date range of 2 variables. the user can changes the values and then submit the request.

The Default cannot be a caculated value.

Hope this helps




Scott

Hi Frank,

I think I understand your problem. If you are using the autoprompt screen I'm sure it will never work. Some months ago I had the same problem and came to the following conclusion. The reason why this will never work with the autoprompt screen is because the &var's are never checked or resolved before the autoprompt screen is constructed. There is no instruction or funtion or whatever to tell Webfocus that an &var should be resolved before it prompts for other &vars. It simply cannot be done with autoprompt.

If you realy need this you should create your own html parameter screens.

Hope this helps.
FrankDutch,
If you need to make the DEFAULT value into a variable, I suggest using DM to construct the entire content of the DEFAULT statement:

-SET &AMBER = '&' ;
-SET &TEXT = '-DEFAULT ' | &AMBER || 'X=' || &COMPUTEDVALU ;
&TEXT ;

If &COMPUTEDVALUE contains 99, then &TEXT will contain '-DEFAULT &X=99' which is a valid DEFAULT statement. Presto, the 'static' syntax of DEFAULT is now has content that will differ with each run.

Chris Burtt


WIN/2K running WF 7.6.4
Development via DevStudio 7.6.4, MRE, TextEditor.
Data is Oracle, MS-SQL.
Sorry Chris, but this does not work and makes it IMHO more complex than needed, but thanks for the thinking




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

-DEFAULT &DT_FILT_V1 = '&YYMD.EVAL';

works for me. So does this:

-DEFAULT ERRORNUM = '&FOCERRNUM.EVAL';

This does too:

-DEFAULT &TITLE_TEXT = '&FEX_NAME.EVAL';


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Francis,

Sorry, but as far as I know, this cannot work with autoprompting. If you use this code in a autoprompt you will get &YYMD.EVAL in the textbox and not the current date like 20070206. This is due to the fact that the variables are not resolved before prompting. There is no way to tell WebFOCUS if it needs to prompt for the variable or to resolve the variable.

Regards,
Dirk, you're absolutely right. I never use auto-prompting, so I've never had to worry about that aspect.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Frank,
Have this issue been resolved? This has been my problem since I use WF for reporting. I was thinking about using the fex to return the calculated date in XML file for the HTML &variable, but don't know how to allow users to override the value.


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
Hua

No it is not.
But I have seen a smart workaround that I need to workout.

The idea is to create overnight a small text file that holds the line
-DEFAULT &PERIODE='200812'; (the actual month ore the date you want it it to be)...
Now this small file comes in place of the code line in your fex, with an INCLUDE.
If the user runs the program by default the auto prompted value will be this value but the user can change it.

If you need only ones something like this, this can be done, but if you need 10 or 20 different values you have to create 10 or 20 different include files.

The daily or monthly creation of this files wont be to difficult.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

Hi Frank,

Thanks for the work around solution. It will be good enough for a single application.

I am thinking this would be tricky to re-use these text files for different applications. I mean that 200812 may be the &ENDING_PERIOD in one application and is meant for the &CURRENT_PERIOD for the next application; And the default value for &FROM_DATE in monthly report will be different from the annual repport. So managing these files can be quite challenge as they will affect how we name the variables in the applications.

Hua


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS