Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     DEFAULTing an &VAR with another &VAR.. cool trick
Go
New
Search
Notify
Tools
Reply
  
DEFAULTing an &VAR with another &VAR.. cool trick
 Login/Join
 
Expert
posted
at Summit, i learned this
-DEFAULT &STARTDAY = &YYMD.EVAL ;
-TYPE &STARTDAY

sometime back, one of us had wanted to initialize a startdate with a variable value like a system date, and then allow the launch page to override it.
And I learned how to do this at dinner at Summit from the FocWizard himself. Its just the .EVAL that makes it work! So simple, but who knew?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Virtuoso
posted Hide Post
O Sussanah....
that was me who asked this and I knew the .eval but the thing is I still want the prompt to appear with that calculted day, so the enduser can overwrite that value, I'm afraid that does not work.
it needs some javascripting...




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

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Reply With QuoteReport This Post
<JJI>
posted
Susannah,

Sorry, but Frank is absolutly right. Even with the wfdescribe = XMLPROMT is does not work, I tested this in WF 7.1.4 and in 7.6.0.
This will never work unless Information Builders start handeling the autopromt differently. The reason why it does not work now is very simple. WF cannot distinct the amper variables to prompt for and the amper variables to resolve before the autoprompt starts. The new -DEFAULTH won't change that!
 
Reply With QuoteReport This Post
Expert
posted Hide Post
rats. well, lets see if Focwizard has his ears on...and see what he can do for us...
I've got it working fine from a ss launch page...not autoprompt, tho .. hmmm.

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




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Member
posted Hide Post
Unfortunately, that's a problem with how AutoPrompting is done. It only does a SCAN of the lines, NOT an execution, looking for amper variables which have not been initialized. Since a '.EVAL' function would require execution, it's not done. This is the same reason, if you code:

-INCLUDE &FILE

the contents of '&FILE' can NOT be scanned, as the value of &FILE is only known at execution time.

The closest I can get to doing what you want, is to set a -DEFAULT for the variables you want, with the values you want, PRIOR to execution (perhaps created by a batch job each night).

For example, if I want 'STARTDATE' to default to a value of YESTERDAY, I can run a batch job, which creates a FEX (I'll call it DEF_STARTDATE), which looks like:

-DEFAULT &STARTDATE= whatever ;

Where 'whatever' has the VALUE needed. If run on 07/06/25, and you need it to have the prior days' date, it would say:

-DEFAULT &STARTDATE = 070624;

Then, any procedure which NEEDS this default, could code:

-INCLUDE DEF_STARTDATE

since we CAN look at 'real' included files.
 
Posts: 25 | Location: 2 Penn Plaza 28 fl | Registered: March 27, 2003Reply With QuoteReport This Post
Expert
posted Hide Post
What about something like this:

- filedef a temp fex file
- write into the fex file
- include the fex file

SET DEFCENT = '20';

FILEDEF DEFAULT1 DISK DEFAULT.FEX
-RUN

-WRITE DEFAULT1 -DEFAULT &|DATE1='&MDY.EVAL' 

-INCLUDE DEFAULT1

TABLE FILE GGORDER
PRINT
*
WHERE ORDER_DATE LE '&DATE1'
END


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
so,Francis, can the user override the &DATE1 from a launch page or from a prompt?
(i'm prompt-impaired in devstu, at the moment).




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Expert
posted Hide Post
My guess is Yes, because the -DEFAULT line that's generated by the -WRITE and -INCLUDE is a normal one, with no .EVAL in it.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
The point about autoprompt, as FocWizard said, is that there is only a scan of the code prior to the autoprompt generation. The code is not run, ergo a -WRITE or FILEDEF etc cannot be completed before the autoprompt kicks in.

What will happen in this case is that the user would enter a value and then the -WRITE and -INCLUDE kick in when the code does run, after the autoprompt.

The only way is to have a pre-existing file to -INCLUDE. Then the user will get a value displayed that can be overridden by the user.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Expert
posted Hide Post
Understood. But why would the pre-existing -INCLUDE execute before the auto-prompt?

And what, really, is the use of auto-prompt? Most of the users I have worked with would be bewildered if they get a screen of the type that auto-prompt generates. Wouldn't it be nicer to develop an HTML page that collects the required user input?


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
The pre-existing -INCLUDE is brought in as its content is part of the host process, and may effect what the autoprompt needs to generate.

And whilst I agree that an HTML page is superior, the number of posts that it generates tells us that many find it useful.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Expert
posted Hide Post
Alan is absolutely correct in that the HTML page is superior (or preferable for some) over the auto-prompt screen.

That said, my current Client's user base is very used to the auto-prompt screen (and in fact loves it?) but there are occasions when the need to chain some inputs is required. So what I have done is mimiced the auto-prompt screen with a combination of base page with a frameset and a parm screen so that the chaining can be achieved without too huge a change to the experience - we all know that Users hate change!! There is even the option to run in new window, blat the output frame of a report, or refresh the page. The end users know little difference but they moved over to it easily.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5661 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Back to the original question, how to set a date as a default value for automprompt.

Taking another slight step on the techniques that FocWizard and Francis have come up with, a method by which you can now calculate a date (or other values) and have it displayed as a default in autoprompt, without having to run to batch type approach, though it is a bit of overkill.

In the server edasprof (ibi\srvnn\wfs\etc\edasprof.prf), add
FILEDEF DEFAULT1 DISK DEFAULT.FEX
-RUN
-WRITE DEFAULT1 -DEFAULT &|DATE1='&MDY' 
-*You can also do date calculations here as well.


In your focexec
-INCLUDE DEFAULT1
.
.
WHERE dateField EQ '&DATE1';
.
.

(Thanks to Francis and FocWizard)


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Expert
posted Hide Post
A good solution Alan, that I hope to never have to use, since I hope I'm never asked to use auto-prompting!

Cheers.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I like that solution Alan, especially if I can calculate the actual and previous month and write more than one versions of the default fex.
this can be done unattended and daily (monthly)
I would put those fexes in my baseapp.




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

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     DEFAULTing an &VAR with another &VAR.. cool trick

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.