Focal Point
[SOLVED] Attempting to set the initial value of a drop down parameter

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

September 21, 2017, 10:43 AM
Don Garland
[SOLVED] Attempting to set the initial value of a drop down parameter
I have an HTML doc, with 3 chained drop down boxes (combobox1,2,3). Each uses the Dynamic/Default data source method. Each resolves a parameter and passes to the next. They work as expected.

I am trying to set the initial value of the first box from an amper var (&BUSINESS_MODEL) that is present when the HTML page loads using the following function.

 function onInitialUpdate() {
document.getElementById("combobox1").value = "!IBI.AMP.BUSINESS_MODEL;";
}
 


The drop downs works fine until I add the code above, then it appears blank.

The load task is set to refresh input controls

Is there anything else that must be set to make this work?

This message has been edited. Last edited by: Don Garland,


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
September 21, 2017, 11:22 AM
Tom Flynn
Don,
Instead of displaying from a data source, can you use a fex?

Example:
  
TABLE FILE CAR
SUM
   COMPUTE COUNTRY/A10 = 'Garland';
   COMPUTE SORT_1/A1   = '1';
   CAR NOPRINT
  BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1;
 ON TABLE HOLD AS HOLD1
END
-RUN
TABLE FILE CAR
SUM
   COMPUTE SORT_1/A1   = '2';
  BY COUNTRY 
 ON TABLE HOLD AS HOLD2
END
-RUN
TABLE FILE HOLD1
PRINT
    COUNTRY
  BY SORT_1 NOPRINT
  BY COUNTRY 
 ON TABLE PCHOLD FORMAT XML
MORE
FILE HOLD2
END
-EXIT



Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
September 21, 2017, 12:11 PM
Don Garland
Yes, I've been trying to get away from using fex based requests, the explicit method, because in almost every case, the HTML doc develops an error trying to resolve the variables when you open it. It's annoying. Plus I like less moving parts if I can get away with it.

Not sure what's keep this from working, I used an example from an earlier post and it worked in a car example so it should work here.


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
September 21, 2017, 12:21 PM
Tom Flynn
Hi Don,
It is "my" understanding, !IBI.AMP is used only within -HTMLFORM statements, may be wrong...
Did you try with single quotes, or, no quotes?
Just kind of guessing now...
Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
September 21, 2017, 01:15 PM
Don Garland
Yes, single quotes didn't help. Dang, I think your right about the -HTMLFORM, my car example used that and it was working. Okay I'll mark this as [SOLVED].

Thank you,
September 21, 2017, 05:41 PM
Waz
You can hard code a default in the HTML page, or you can use a fex to set a default in a calling HTML page that the composer page will pick up a default for you (which is what we do here).

<html>
<head>
<script type=text/javascript>
function OnLoad() {
var prepParms=[];
prepParms.push("{control}={def value}");
window.sessionStorage.setItem("composerSaveParameters", prepParms.join("^AS^"));
document.forms.temp.submit();
}
</script>
</head>
<body onload="OnLoad()">
<form name="temp" method="get" action="/ibi_apps/WFServlet">
<input type="hidden" name="IBIMR_savedParamFile" value="IBIMR_savedParamFile"/>
<input type="hidden" name="IBFS1_action" value="RUNFEX"/>
<input type="hidden" name="Rand" value="blah blah"/>
<input type="hidden" name="IBFS_path" value="{IBFS file location}"/>
</form>
</body>
</html>



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!