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     [CLOSED]-DEFAULT prompt to show the value of an amper variable
Go
New
Search
Notify
Tools
Reply
  
[CLOSED]-DEFAULT prompt to show the value of an amper variable
 Login/Join
 
Guru
posted
I have the following code to dynamically choose a 4 week period:
 
-SET &DATE1 = AYMD ( &YYMD , - 35 , 'I8YYMD'); 
-SET &BEGDATE = AYMD ( &DATE1 , - DTPART( '&DATE1', WEEKDAY ) + 1 , 'I8YYMD'); 

-SET &DATE2 = AYMD ( &YYMD , - 7 , 'I8YYMD'); 
-SET &ENDDATE = AYMD ( &DATE2 , - DTPART( '&DATE2', WEEKDAY ) , 'I8YYMD'); 

-DEFAULT &FROM_DATE = &BEGDATE.EVAL;
-DEFAULT &TO_DATE = &ENDDATE.EVAL;

-TYPE &FROM_DATE.EVAL
-TYPE &TO_DATE.EVAL
 


I would like to have the default parameters actually show the amper values of 20160403 and 20160430 in this example. The values are passed as you can see in the -TYPE output, but I would like to see those values in the prompt that the end user will see to give them the option to change the date if they would like.

This message has been edited. Last edited by: <Emily McAllister>,


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 455 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Master
posted Hide Post
The auto prompt is because you don't have a value in it. If your wanting to prompt with default values, then you need to build your page to prompt via your own code, then pass the values to use.

-DEFAULT &FROM_DATE = _FOC_NULL;
-DEFAULT &TO_DATE = _FOC_NULL;

-SET &DATE1 = AYMD ( &YYMD , - 35 , 'I8YYMD');
-SET &BEGDATE = AYMD ( &DATE1 , - DTPART( '&DATE1', WEEKDAY ) + 1 , 'I8YYMD');

-SET &DATE2 = AYMD ( &YYMD , - 7 , 'I8YYMD');
-SET &ENDDATE = AYMD ( &DATE2 , - DTPART( '&DATE2', WEEKDAY ) , 'I8YYMD');

-IF &FROM_DATE EQ _FOC_NULL THEN GOTO PROMPTDATA;

-TYPE &FROM_DATE
-TYPE &TO_DATE
-GOTO EOF

-PROMPTDATA
-HTMLFORM BEGIN
<html>
<script>
function submit() {
	var from_date = document.getElementById('FROM_DATE').value;
	var to_date = document.getElementById('TO_DATE').value;
	var url=location.href+'&|FROM_DATE='+from_date+'&|TO_DATE='+to_date;
	location.href=url;
}
</script>
<style>
.button {
	width: 60px;
	height: 20px;
	line-height: 20px;
	background-color: #c0c0c0;
	border: 1px solid #000;
	cursor: pointer;
	text-align: center;
	margin: 2px;
	color: #fff;
}
</style>
<body>
From Date: <input id="FROM_DATE" name="FROM_DATE" value="&BEGDATE.EVAL"><br/>
To Date: <input id="TO_DATE" name="TO_DATE" value="&ENDDATE.EVAL"></br>
<div class="button" onclick="submit()">Run</div>
</body>
</html>
-HTMLFORM END
-EOF



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Reply With QuoteReport This Post
Guru
posted Hide Post
Good One


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Reply With QuoteReport This Post
Master
posted Hide Post
...or make an HTML.

And dynamically fill the inputboxes with a .fex ( producing an XML ) with the correct value.


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 669 | Location: Veghel, The Netherlands | Registered: February 16, 2010Reply With QuoteReport This Post
Master
posted Hide Post
quote:
...or make an HTML.

And dynamically fill the inputboxes with a .fex ( producing an XML ) with the correct value.


That's basically what my code does. It's an HTML within a fex and auto fills with set defaults.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Reply With QuoteReport This Post
Master
posted Hide Post
Gavin,

I know. But it's handcoded.
If you just make an .fex like:

 TABLE FILE CAR
 SUM FST.CAR
 BY HIGHEST 1 COUNTRY
 ON TABLE PCHOLD FORMAT XML
 END


You can do the rest in the HTML-composer GUI. ( without coding )
And you can even reuse it for other HTML-screens.



...
Or do it like this:
I use this to drill from a list to a HTML-prompt screen and auto-run.
The user can also directly start the HTML-prompt screen without auto-run.

-DEFAULTH &SELECTED_LIST_VALUE = '';
-* prevent auto-prompting 

-HTMLFORM IBFS:/WFC/Repository/d1frsupp/std_reports/1026/1026_artikelzoeker.htm

-IF &SELECTED_LIST_VALUE NE '' OR ' ' THEN CONTINUE ELSE EXIT;
-HTMLFORM BEGIN
<SCRIPT LANGUAGE='JSCRIPT'>
document.getElementById('input_user_value').value = '!IBI.AMP.SELECTED_LIST_VALUE;';
document.getElementById('form1Submit').click();
</SCRIPT>
-HTMLFORM END


...It can be done in all sorts of ways.


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 669 | Location: Veghel, The Netherlands | Registered: February 16, 2010Reply With QuoteReport This Post
Master
posted Hide Post
I'm a big components of "handcoding" or find yourself limited to UI restraints and have your job replaced by a BA as it's no longer development if your relying on something to write the code for you.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Reply With QuoteReport This Post
Master
posted Hide Post
I'm a BA :-)


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 669 | Location: Veghel, The Netherlands | Registered: February 16, 2010Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED]-DEFAULT prompt to show the value of an amper variable

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