Focal Point
[CASE OPENED] Dynamic Selected Value for parameters in HTML

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

September 29, 2015, 10:31 AM
Nicholas Spyrison
[CASE OPENED] Dynamic Selected Value for parameters in HTML
Seemingly simple question, but;

I have a yyyymm parameter and I want the HTML Selected Value to default to the current month.

In a Fex I would use (&YYMD / 100). When I try this in the HTML it just defaults to the top value.

Thanks!

This message has been edited. Last edited by: Nicholas Spyrison,


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
September 29, 2015, 01:50 PM
MartinY
Use
-* With slash
-SET &WSLASH = &DATEYYM;
-TYPE &WSLASH
-* Without slash
-SET &WOSLASH = EDIT(&DATEYYM,'9999$99');
-TYPE &WOSLASH



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
September 29, 2015, 02:47 PM
Nicholas Spyrison
OK, then I plug &WOSLASH in the Selected Value in the HTML and defaults to the top value.

Will the HTML Page evaluate &WOSLASH ?


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
September 29, 2015, 03:07 PM
MartinY
Yes, using something such as:
YourField.value = '!IBI.AMP.WOSLASH;';


But &WOSLASH as to be initialized in a fex which call the HTML.

Or other technics are available depending on the nature of your parameter that must have the WOSLASH value.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
September 29, 2015, 03:21 PM
Nicholas Spyrison
Do this in the Embedded JavaScript/CSS tab?

I have Selected Value: &CURYM
and the the following in the JS/CSS:
 DM.DM.Date_Calendar_Month_YYYYMM.value = '!IBI.AMP.CURYM;'; 


Still no dice


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
September 29, 2015, 03:31 PM
MartinY
Yes in the embedded javascript tab.
Try displaying your value first to be sure that it is properly initialized:
var curval = '!IBI.AMP.CURYM;';
alert (curval);



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
September 29, 2015, 03:54 PM
Nicholas Spyrison
returns
 !IBI.AMP.CURYM; 



_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
September 30, 2015, 08:07 AM
MartinY
Create a procedure (fex) in DefaultDomain with the following:
-SET &CURYM = EDIT(&DATEYYM,'9999$99');
-HTMLFORM IBFS:/WFC/Repository/DefaultDomain/z.htm


Then create an HTML form (named "z" as per my sample) in the same Content having this in the embedded java script tab

function window_onload() {
 
UpdateData();

var curval = '!IBI.AMP.CURYM;';
alert (curval);
}


Then run the procedure, you should have a popup displaying 201509.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
September 30, 2015, 11:05 AM
Nicholas Spyrison
I have the popup displaying 201509.

commented out the alert.

It looks like it is trying to replicate the HTML file with the fex's frame. Do I need to specify a frame in the html filepath?

I also have curval in the Selected Value box it populates the first value rather than 201509.


Thanks for the continued support!


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
October 01, 2015, 11:10 AM
Barry Solomon
Hi Nicholas

I just saw your post and if you are using App Studio go to the settings panel or in Dev Studio go to the properties and setting window and look for "Selected Value" that will be the default and if you want a dynamic value set the Dynamic radio button and select a proc which will return the current date or the calculated date for the control to use. In App Studio you can set the current date with a check box.

Thanks Barry


WebFOCUS 8
Windows, All Outputs
October 01, 2015, 11:37 AM
Nicholas Spyrison
quote:
I just saw your post and if you are using App Studio go to the settings panel ... and look for "Selected Value" that will be the default and if you want a dynamic value set the Dynamic radio button and select a proc which will return the current date or the calculated date for the control to use.


Right I have all this, the date is stored in &CURYM, the "Selected Value" doesn't evaluate &CURYM how do I apply it?

quote:
In App Studio you can set the current date with a check box.

Where? still on the Settings tab. keep in mind that I need yyyymm rather than the date.


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
October 01, 2015, 12:28 PM
dhagen
You can do this completely in JS. In an onInitialUpdate function, add:
    var d = new Date();
    var n = d.getMonth();
    var dt;
    if (n < 9) {
       dt = d.getFullYear().toString() + "/0" + (n+1).toString();
    } else {
       dt = d.getFullYear().toString() + "/" + (n+1).toString();
    }
    DM.DM.Date_Calendar_Month_YYYYMM.value = dt;
 



"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
October 01, 2015, 12:43 PM
Nicholas Spyrison
do so then how do I get the DM.DM.Date_Calendar_Month_YYYYMM.value dropdown conrol to default to dt?

I can't put dt in the "Selected Value" setting


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
October 02, 2015, 12:59 AM
dhagen
All kinds of ways


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
October 06, 2015, 10:43 AM
Nicholas Spyrison
function window_onload() {

    var d = new Date();
    var n = d.getMonth();
    var dt;
    if (n < 9) {
       dt = d.getFullYear().toString() + "/0" + (n+1).toString();
   } else {
       dt = d.getFullYear().toString() + "/" + (n+1).toString();
    }
    DM.DM.Date_Calendar_Month_YYYYMM.value = dt;


UpdateData();
}  


won't load. any thoughts?


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
October 08, 2015, 09:01 AM
dhagen
Re-read my second last post carefully!

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


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
October 08, 2015, 04:17 PM
Nicholas Spyrison
 function onInitialUpdate() {
    var d = new Date();
    var n = d.getMonth();
    var dt;
    if (n < 9) {
       dt = d.getFullYear().toString() + "/0" + (n+1).toString();
    } else {
       dt = d.getFullYear().toString() + "/" + (n+1).toString();
    }
    DM.DM.Date_Calendar_Month_YYYYMM.value = dt;
}
 


and without function and the code with-in parentheses doesn't work.


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube