Focal Point
[CLOSED]-DEFAULT prompt to show the value of an amper variable

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

May 12, 2016, 01:26 PM
Hallway
[CLOSED]-DEFAULT prompt to show the value of an amper variable
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
May 12, 2016, 01:58 PM
GavinL
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
May 12, 2016, 02:01 PM
Ricardo Augusto
Good One


WebFOCUS 8.1.05 / APP Studio
May 13, 2016, 03:35 AM
Dave
...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
May 13, 2016, 10:57 AM
GavinL
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
May 17, 2016, 03:33 AM
Dave
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
May 17, 2016, 10:00 AM
GavinL
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
May 17, 2016, 10:26 AM
Dave
I'm a BA :-)


_____________________
WF: 8.0.0.9 > going 8.2.0.5