Focal Point
[SOLVED]Pass Value to HTML -APP STUDIO

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

August 02, 2016, 04:08 PM
evan.brown
[SOLVED]Pass Value to HTML -APP STUDIO
I want to run this fex
  
TABLE FILE CAR
PRINT MODEL COUNTRY WARRANTY
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=COUNTRY, TARGET='_blank', FOCEXEC=car_lnch(COUNTRY=COUNTRY), $
END

Then, on the resulting report, click the country hyperlink which runs car_lnch.fex. This is an external fex that only contains
  
-HTMLFORM CAR_PAGE

I would like then to have a hidden variable in car_page (&COUNTRY) that is passed to car_cht.fex, which then displays on car_page.htm at runtime.

I'm at the GUI's mercy when creating my html. I've seen examples of how to do this using !IBI.AMP.COUNTRY, but I don't know how to use this in the APP Studio GUI. Can anyone help explain or possibly even show me a different way to do it? Thanks

I don't know if the code for the html or the other fex is needed, but here it is anyway:

The chart fex:
  
-SET &ECHO=ALL;
-? &

GRAPH FILE CAR
SUM CNT.MODEL
WHERE COUNTRY EQ '&COUNTRY.EVAL'
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH GAUGE1
END



The html code:
  
<!DOCTYPE html>
<html><head><meta http-equiv="X-UA-Compatible" content="IE=Edge"><meta name="mycharsetmeta" http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="Generation" content="Created in release 8008, Generation 4"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"><script type="text/javascript">
//confidential_id=IBI_OptionsScript
var szHtmlAlias="/ibi_apps/ibi_html";var is_mobile="false";var szRunTimeHtmlAlias="runTimeHtmlAlias";var cgipath="cgipath";var ib_composer="ib_composer";var map="ib_composer_map";var grid="ib_composer_grid";var ibiOptions = new Array(cgipath,ib_composer);var nlsScript="/javaassist/nls.js";var glbScript="/javaassist/ibi/html/js/ibigbl.js";var replacePart="<replace>";
var scriptTemplate='<script src="'+replacePart+'" type="text/javascript"><\/script>';if(typeof(szRunTimeHtmlAlias) === 'string' && szRunTimeHtmlAlias.indexOf('/') == 0)szHtmlAlias=szRunTimeHtmlAlias;document.write(scriptTemplate.replace(replacePart, szHtmlAlias + nlsScript));document.write(scriptTemplate.replace(replacePart, szHtmlAlias + glbScript));</script><script type="text/javascript">
//confidential_id=IBI_ibigblloadCss
if(typeof ibigblloadCss === 'function'){ibigblloadCss(null);addIntlTranslatedJS("composertrans.js");}else {alert("JavaScript alias '/ibi_apps/ibi_html'  is not valid.");window.location("about:blank");}</script><title>HtmlPage</title><script type="text/javascript">
//confidential_id=clientEventHandlersJS
 
 
//Begin function window_onload
function window_onload() {
 
 
UpdateData();
 
// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload
</script><style></style><!--//confidential_id=focus_xmlelement
<rootxmlnode focoption="_FOC_NULL" nextelementuniquenumber="2"><html_elements><html_body thumbnailscale="4" use_appl_css="no" maptype="0" autofitchildren="no" mobiledocument="no" edaconnectionrequired="true" ibiapp_app="evan_b/test" ibic_server="EDASERVE" isdataserversarea="1"><html_event eventname="load" eventhandlername="window_onload"/></html_body><html_element bindcontrolid="chart1" elementtype="3" myviewonautofit="dontyouever" containerdisplayas="child"/><html_element bindcontrolid="panel1" elementtype="34" form_dist_between_desc_and_input="5" form_newline_chain="1" form_prompt_location="1" form_number_of_columns="4" form_number_of_visible_rows="4" myviewonautofit="dontyouever" autofitchildren="no" containerdisplayas="child"><html_event eventname="submit" eventhandlername="onExecuteEventHandler"/></html_element><html_element bindcontrolid="COUNTRY" requiredfield="1" boundtovariable="1" defaultlocation="0,0,19,122" myviewonautofit="dontyouever" defaultselection="1" controltype="7"><link linktype="default"><condition default="1" name="Default" whattodowithcontrol="4"><data_info datatype="0"></data_info></condition></link></html_element><html_element bindcontrolid="label1" myviewonautofit="dontyouever"/><html_element rtFileName="cgipathsub/ibi_html/javaassist/ibi/html/composer/themes/nonBindows/IBI-Themes/default_theme.css" type="cssfile"/><html_element rtFileName="cgipathsub/ibi_html/javaassist/ibi/html/composer/themes/nonBindows/IBI-Themes/ibi.css" bindcontrolid="IBI_THEME_CSS" desc="Information Builders" type="cssfile"/></html_elements><variables><variable controltype="7" name="COUNTRY" parametercreatedinreslay="0" top="105" left="388" width="79" height="20" inbinding="1" type="unresolved" desc="COUNTRY" default="" textvarname="" accept="0" select="0" create="1" requests_list="chart1"><link linktype="default" persistentuniqueid="compUid_1" from="COUNTRY" controltype="7"><condition default="1" name="Default" whattodowithcontrol="4"><data_info datatype="0" sourcetype="typeMaster" displayfield="COUNTRY" ibiformat="A10" datafield="COUNTRY" datasource="car.mas" ibif_ex="car" selectedvalue="" operation="" slider_range_from="" slider_range_to="" previewvalue=""></data_info></condition><link linktype="default"><condition default="1" name="Default" whattodowithcontrol="4"><data_info datatype="0"></data_info></condition></link></link></variable></variables><input_controls><input_control bindcontrolid="COUNTRY" elementtype="7" name="edit1" multiple="0" inbinding="1" controltype="7"><link linktype="default" persistentuniqueid="compUid_2"><condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0"><data_info datatype="0" datasource="car.mas" ibif_ex="car" datafield="COUNTRY" displayfield="COUNTRY" addalloption="0" sourcetype="typeMaster" cacheruntimedata="0" ibiformat="A10" dfformat="A10" accept="0" operation="NONE"><static_values><static value="" display="" selected="0" noinput="0"></static></static_values></data_info></condition></link></input_control></input_controls><requests><request requestid="chart1" sourcetype="typeFex" ibif_ex="car_cht.fex" ibiapp_app="evan_b/test" activeType="-1" activereport="0" compoundreport="0"/></requests><other_bound_objects></other_bound_objects><tasks><task id="load" trigger="load"><taskitem id="chart1" sourcetype="typeFex" targettype="iframe" targetname="chart1"/></task></tasks><animations></animations></rootxmlnode>
--><script type="text/javascript">
//confidential_id=updateHeadElements
if(typeof updateHeadElements === 'function'){updateHeadElements();}</script></head><body class="IBI_PageBg"><iframe title="car_cht.fex" class="IBI_Report-iFrame IBI_rounded_m" id="chart1" scrolling="no" style="left: 10px; top: 110px; width: 600px; height: 350px; position: absolute; z-index: 1;" name="chart1"></iframe><div class="IBI_ReportControlPanel IBI_rounded_m" id="panel1" style="left: 10px; top: 30px; width: 450px; height: 49px; position: absolute;"><label class="IBI_ReportControlLabel" id="label1" style="left: 5px; top: 5px; width: 435px; height: 15px; position: absolute; z-index: 2; cursor: default;" for="COUNTRY" name="edit1">This value will be hidden. It needs to come from car_rpt.fex and go to car_cht.fex</label><input tabindex="1" class="IBI_ReportControlTarget  IBI_rounded_s" id="COUNTRY" style="left: 5px; top: 25px; width: 142px; overflow: visible; position: absolute; z-index: 3; -ms-overflow-y: visible;" type="text" name="COUNTRY"></div></body><script type="text/javascript">
//confidential_id=IBI_loader
if(typeof doBeforeLoad === 'function'){doBeforeLoad();}function AdjustChildrenPosition(){
}
</script></html>
<!-- cc nfvf -->

This message has been edited. Last edited by: evan.brown,


WF 8.0.08 (Prod); WF 8.2.06 (Dev)
August 03, 2016, 03:00 AM
Neelima
Hi.

Please use

< !DOCTYPE html>
<script type="text/javascript">
//confidential_id=IBI_OptionsScript
var bRuntimes=true;var szHtmlAlias="./ibi_html/";var is_mobile="false";var szRunTimeHtmlAlias="runTimeHtmlAlias";var cgipath="cgipath";var ib_composer="ib_composer";var map="ib_composer_map";var grid="ib_composer_grid";var emf="ib_composer_emf";var ibiOptions = new Array(cgipath,ib_composer);if(typeof(szRunTimeHtmlAlias) === 'string' && szRunTimeHtmlAlias.indexOf('/') == 0)szHtmlAlias=szRunTimeHtmlAlias;document.write('<script src="'+szHtmlAlias+'ibigbl.js" type="text/javascript"><\/script>');<script type="text/javascript">
//confidential_id=IBI_ibigblloadCss
if(typeof ibigblloadCss === 'function'){ibigblloadCss(null);addIntlTranslatedJS("composertrans.js");}else {alert("JavaScript alias './ibi_html/' is not valid.");window.location("about:blank");}HtmlPage<script type="text/javascript">
//confidential_id=clientEventHandlersJS


//Begin function window_onload
function window_onload() {


UpdateData();

// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload
< !--//confidential_id=focus_xmlelement




--><script type="text/javascript">
//confidential_id=updateHeadElements
if(typeof updateHeadElements === 'function'){updateHeadElements();}<iframe title="car_cht.fex" class="IBI_Report-iFrame IBI_rounded_m" id="chart1" scrolling="no" style="left: 10px; top: 100px; width: 600px; height: 350px; position: absolute; z-index: 1;" name="chart1">
<script type="text/javascript">
//confidential_id=IBI_loader
if(typeof doBeforeLoad === 'function'){doBeforeLoad();}function AdjustChildrenPosition(){
}


< !-- cc nstk -->


calling main fex:-

TABLE FILE CAR
PRINT
CAR.CARREC.MODEL
CAR.ORIGIN.COUNTRY
CAR.WARANT.WARRANTY
ON TABLE NOTOTAL
ON TABLE SET STYLE *
$
TYPE=DATA,
COLUMN=N2,
FOCEXEC=IBFS:/WFC/Repository/Test/car_lnch.fex( \
COUNTRY=CAR.ORIGIN.COUNTRY \
),
TARGET='_blank',
$
ENDSTYLE
END


car_lnch.fex

-HTMLFORM IBFS:/WFC/Repository/Test/check.htm
<script type="text/javascript">
document.getElementById('COUNTRY').value = '!IBI.AMP.COUNTRY;';


I hope this will help you.

Thanks and Regard,
Neelima


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
August 03, 2016, 05:54 AM
Tony A
Easiest method?

Change your car_lnch.fex to -
-DEFAULT &COUNTRY = '_FOC_NULL'
-HTMLFORM car_page


Open your HTML page in composer, open the parameters tab and select your "hidden" control (the lozenge shaped one), right click and select "settings". Ensure the "data Type" is set to "static" and click on the "new" icon. Add the value !IBI.AMP.COUNTRY; - not forgetting the exclamation mark and the trailing semi-colon.

Save and run.

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 
August 03, 2016, 06:02 AM
Neelima
quote:
-DEFAULT &COUNTRY = '_FOC_NULL'


Yes, Tony this is your simplest and minimal coding technique for passing Parameter in html page.

I have used JS code for the same.

-HTMLFORM IBFS:/WFC/Repository/Test/check.htm
<script type="text/javascript">
document.getElementById('COUNTRY').value = '!IBI.AMP.COUNTRY;';


Both code are working fine.


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
August 03, 2016, 08:56 AM
evan.brown
I can't believe it was that easy! Thank you very much!!!!


WF 8.0.08 (Prod); WF 8.2.06 (Dev)
August 03, 2016, 12:21 PM
Kofi
I see what Neelima is try do but is wrong because include script in HTML need be -HTMLFORM BEGIN and -HTMLFORM END yes?

Incorrect syntax may cause issue later. I be taught that be bad practice.

Also rely on script to execute at right time onload? Bad try, needs more control. Also no close script tag, very poor if I do that.

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
August 03, 2016, 12:41 PM
GavinL
quote:
I see what Neelima is try do but is wrong because include script in HTML need be -HTMLFORM BEGIN and -HTMLFORM END yes?


Depends.. Is the HTML in an HTML file or a FEX.. If in a FEX, then yes, if in an HTML then no.

Personally, I don't use HTML Composer, I put all my HTML in FEXes and write all my code at an HTML5/CSS3 standard. This way I can pass anything I want using FEX Parameters and still have the greatness of HTML5/CSS3. Unbound to the limits of HTML Composer.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
August 04, 2016, 02:59 AM
Neelima
Thanks Kofi for explaining the code and bad practice. Smiler

basically I was focusing only Important line of code for solving the issue.

Thanks.


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies