Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED]dynamic preselection &/or save selection not really getting along...

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED]dynamic preselection &/or save selection not really getting along...
 Login/Join
 
Guru
posted
Many times IBI has told us to not precede an html report with a procedure because save selection, etc. will not work. Many times developers have ignored the warnings because we need to set defaults for controls dynamically. The javascript workarounds often suggested to replace this method seem tedious and unnecessary except for a few reports. Now both parties can be satisfied with this method.

Instead of doing something like:
 
fex:
-SET &country = 'JAPAN';
-HTMLFORM myhtml.htm

Html:
 



You can have the html run first (and not have to run the fex everytime you want to test the html!).

My new html:

 
<HTML>
<HEAD>
<META id=mycharsetmeta content="text/html; charset=ISO-8859-1" http-equiv=Content-Type>
<META id=Generation content="Created in release 7703, Generation 3.0">
<SCRIPT id=IBI_RelCallBack type=text/javascript>function AdjustChildrenPosition(){
}
</SCRIPT>

<SCRIPT id=IBI_OptionsScript type=text/javascript>
var cgipath = "cgipath";
var ibirls = "ibirls3";

var rltdyncalendar = "rltdyncalendar";
var gmap = "ibigmap";
var olap="olap";
var olappanebase="olappanebase";
var olapdrill="olapdrill";

var ibixmltree="ibixmltree";

var ibiOptions = new Array(cgipath,ibirls);
</SCRIPT>

<SCRIPT id=IBI_nls type=text/javascript src="/ibi_html/javaassist/nls.js"></SCRIPT>

<SCRIPT id=IBI_nlsVars type=text/javascript src="/ibi_html/javaassist/nlsvars.js"></SCRIPT>

<SCRIPT id=IBI_ibigbl type=text/javascript src="/ibi_html/javaassist/ibi/html/js/ibigbl.js"></SCRIPT>

<SCRIPT id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);
addIntlTranslatedJS("composertrans.js");
</SCRIPT>
<TITLE>HtmlPage</TITLE>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//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

function setCombobox1(country) {
	IbComposer_setCurrentSelection('combobox1', country, true);
} 
</SCRIPT>

<SCRIPT for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" edaconnectionrequired="true" nextelementuniquenumber="6" thumbnailscale="4" elementtype="21">
<IFRAME style="Z-INDEX: 1; POSITION: absolute; WIDTH: 1px; HEIGHT: 1px; TOP: 40px; LEFT: 50px" id=report1 title=test.fex tabIndex=1 src="" frameBorder=no elementtype="2" HEIGHTOLD="1" WIDTHOLD="1" requests_list="0" autoExecute="True" name="report1"></IFRAME>
<SELECT style="Z-INDEX: 2; POSITION: absolute; WIDTH: 150px; TOP: 100px; LEFT: 80px" id=combobox1 tabIndex=2 defaultselection="1" persistentuniqueid="compUid_2" name="combobox1"></SELECT> 
<SELECT style="Z-INDEX: 3; POSITION: absolute; WIDTH: 150px; TOP: 100px; LEFT: 290px" id=combobox2 tabIndex=3 defaultselection="1" persistentuniqueid="compUid_4" name="combobox2"></SELECT>    
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=layoutinfo type=hidden>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibiapp_app value=replace_with_your_app_folder type=hidden name="ibiapp_app">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibic_server value=EDASERVE type=hidden isdataserversarea="1" name="ibic_server">
<xml id=focus_xmlelement>
<script type="text/xml" nextelementuniquenumber="5">
	
<rootxmlnode focoption="_FOC_NULL" top="20" left="524" width="150" height="130">
		
<variables></variables>
		
<input_controls>
			
<input_control bindcontrolid="compUid_2" elementtype="8" name="combobox1" id="combobox1" multiple="0" onetimepopulated="0" inbinding="1">
				
<link linktype="default" persistentuniqueid="compUid_2">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info checkForDuplicateValues="0" sourcetype="typeMaster" modifiedrequest="0" datatype="1" ibiapp_app="replace_with_your_app_folder" datasource="CAR.mas" displayfield="CAR.ORIGIN.COUNTRY" ibiformat="A10" dfformat="A10" datafield="CAR.ORIGIN.COUNTRY">
							
<![CDATA[TABLE FILE CAR
SUM FST.CAR.ORIGIN.COUNTRY
 BY CAR.ORIGIN.COUNTRY
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END
]]></data_info></condition></link></input_control>
			
<input_control bindcontrolid="compUid_4" elementtype="8" name="combobox2" id="combobox2" multiple="0" inbinding="1" onetimepopulated="0">
				
<link linktype="default" persistentuniqueid="compUid_4" from="compUid_2">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0" resolveparameterfq="COUNTRY" resolveparameter="COUNTRY">
						
<data_info checkForDuplicateValues="0" sourcetype="typeMaster" datatype="1" modifiedrequest="0" ibiapp_app="replace_with_your_app_folder" datasource="CAR.mas" displayfield="CAR.COMP.CAR" ibiformat="A16" dfformat="A16" datafield="CAR.COMP.CAR">
							
<![CDATA[TABLE FILE CAR
SUM FST.CAR.COMP.CAR
 BY CAR.COMP.CAR
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END
]]></data_info></condition></link></input_control></input_controls>
		
<other_bound_objects></other_bound_objects>
		
<requests nextrequestsid="0">
			
<request requestid="0" targettype="iframe" targetname="report1" sourcetype="typeFex" ibif_ex="test.fex" ibiapp_app="replace_with_your_app_folder" activereport="0" compoundreport="0"></request></requests></rootxmlnode></script>
</xml></BODY>
<SCRIPT id=IBI_loader type=text/javascript>
doBeforeLoad();
</SCRIPT>
</HTML>
 


My new fex:

 
-* File test.fex
-SET &country = 'JAPAN';
-HTMLFORM BEGIN
<script>
parent.setCombobox1('!IBI.AMP.country;');
</script>
-HTMLFORM END
 




What I did was reference the procedure from within the html page, make sure autoexecute is set to true, make the report 1 px by 1 px and turn frame borders off (so you can't see it when it executes), and finally I call the function setcombox1 in the html to set my default value. Notice in the function that I have the boolean set to true in:
 IbComposer_setCurrentSelection('combobox1', country, true); 
This necessary to allow the chain to update properly. Depending on your situation, you may need
 IbComposer_ResetDownChainControls('combobox1'); 
to successfully update your chain.

Now the html is executed first, save selection will work, IBI's previous complaints will be satisfied, and the developers life remains simple (in this aspect).
 Note that to run my code you will have to replace my replace_with_your_app_folder text with your app folder. 




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


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report This Post
Expert
posted Hide Post
You can add a really "hidden" text field that is populated by the fex - no need for a report with dimensions of 1px.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Guru
posted Hide Post
Francis, not quite true with chaining it seems (correct me if I'm wrong). I code so that a hidden text box is set to japan and then I reset my control to japan. Problem is that the country is set to japan, but combobox2 is not reset to japan's cars.

I even added the reset down chain control function and still no luck.
 
<HTML>
<HEAD>
<META id=mycharsetmeta content="text/html; charset=ISO-8859-1" http-equiv=Content-Type>
<META id=Generation content="Created in release 7703, Generation 3.0">
<SCRIPT id=IBI_RelCallBack type=text/javascript>function AdjustChildrenPosition(){
}
</SCRIPT>

<SCRIPT id=IBI_OptionsScript type=text/javascript>
var cgipath = "cgipath";
var ibirls = "ibirls3";

var rltdyncalendar = "rltdyncalendar";
var gmap = "ibigmap";
var olap="olap";
var olappanebase="olappanebase";
var olapdrill="olapdrill";

var ibixmltree="ibixmltree";

var ibiOptions = new Array(cgipath,ibirls);
</SCRIPT>

<SCRIPT id=IBI_nls type=text/javascript src="/ibi_html/javaassist/nls.js"></SCRIPT>

<SCRIPT id=IBI_nlsVars type=text/javascript src="/ibi_html/javaassist/nlsvars.js"></SCRIPT>

<SCRIPT id=IBI_ibigbl type=text/javascript src="/ibi_html/javaassist/ibi/html/js/ibigbl.js"></SCRIPT>

<SCRIPT id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);
addIntlTranslatedJS("composertrans.js");
</SCRIPT>
<TITLE>HtmlPage</TITLE>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//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
function onInitialUpdate() {
	IbComposer_setCurrentSelection('combobox1', IbComposer_getCurrentSelection('edit1'), true);
	IbComposer_ResetDownChainControls('combobox1');
}
</SCRIPT>

<SCRIPT for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto" edaconnectionrequired="true" nextelementuniquenumber="8" thumbnailscale="4" elementtype="21">
<SELECT style="Z-INDEX: 2; POSITION: absolute; WIDTH: 150px; TOP: 100px; LEFT: 80px" id=combobox1 tabIndex=2 defaultselection="1" persistentuniqueid="compUid_2" name="combobox1"></SELECT> 
<SELECT style="Z-INDEX: 3; POSITION: absolute; WIDTH: 150px; TOP: 100px; LEFT: 290px" id=combobox2 tabIndex=3 defaultselection="1" persistentuniqueid="compUid_4" name="combobox2"></SELECT>  
<INPUT style="Z-INDEX: 4; POSITION: absolute; WIDTH: 260px; DISPLAY: none; HEIGHT: 22px; TOP: 50px; LEFT: 120px" id=edit1 tabIndex=4 defaultselection="1" persistentuniqueid="compUid_8" rawvalue="JAPAN" name="edit1">    
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=layoutinfo type=hidden>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibiapp_app value=replace_with_your_app_folder type=hidden name="ibiapp_app">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibic_server value=EDASERVE type=hidden isdataserversarea="1" name="ibic_server">
<xml id=focus_xmlelement>
<script type="text/xml" nextelementuniquenumber="7">
	
<rootxmlnode focoption="_FOC_NULL" top="20" left="524" width="150" height="130">
		
<variables></variables>
		
<input_controls>
			
<input_control bindcontrolid="compUid_2" elementtype="8" name="combobox1" id="combobox1" multiple="0" onetimepopulated="0" inbinding="1">
				
<link linktype="default" persistentuniqueid="compUid_2">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info checkForDuplicateValues="0" sourcetype="typeMaster" modifiedrequest="0" datatype="1" ibiapp_app="replace_with_your_app_folder" datasource="CAR.mas" displayfield="CAR.ORIGIN.COUNTRY" ibiformat="A10" dfformat="A10" datafield="CAR.ORIGIN.COUNTRY">
							
<![CDATA[TABLE FILE CAR
SUM FST.CAR.ORIGIN.COUNTRY
 BY CAR.ORIGIN.COUNTRY
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END
]]></data_info></condition></link></input_control>
			
<input_control bindcontrolid="compUid_4" elementtype="8" name="combobox2" id="combobox2" multiple="0" inbinding="1" onetimepopulated="0">
				
<link linktype="default" persistentuniqueid="compUid_4" from="compUid_2">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0" resolveparameterfq="COUNTRY" resolveparameter="COUNTRY">
						
<data_info checkForDuplicateValues="0" sourcetype="typeMaster" datatype="1" modifiedrequest="0" ibiapp_app="replace_with_your_app_folder" datasource="CAR.mas" displayfield="CAR.COMP.CAR" ibiformat="A16" dfformat="A16" datafield="CAR.COMP.CAR">
							
<![CDATA[TABLE FILE CAR
SUM FST.CAR.COMP.CAR
 BY CAR.COMP.CAR
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END
]]></data_info></condition></link></input_control>
			
<input_control bindcontrolid="compUid_8" elementtype="7" name="edit1" id="edit1" multiple="0" onetimepopulated="0">
				
<link linktype="default" persistentuniqueid="compUid_6">
					
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
						
<data_info checkForDuplicateValues="0" accept="0" sourcetype="typeMaster" datatype="1" modifiedrequest="1" ibiapp_app="replace_with_your_app_folder" datasource="CAR.mas" displayfield="CAR.ORIGIN.COUNTRY" ibiformat="A10" dfformat="A10" datafield="CAR.ORIGIN.COUNTRY">
							
<![CDATA[TABLE FILE CAR
SUM FST.CAR.ORIGIN.COUNTRY
 BY CAR.ORIGIN.COUNTRY
WHERE COUNTRY EQ 'JAPAN';
ON TABLE PCHOLD FORMAT XML
END
]]></data_info></condition></link></input_control></input_controls>
		
<other_bound_objects></other_bound_objects>
		
<requests></requests></rootxmlnode></script>
</xml></BODY>
<SCRIPT id=IBI_loader type=text/javascript>
doBeforeLoad();
</SCRIPT>
</HTML>
 


Japanese Jaguar:


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report This Post
Virtuoso
posted Hide Post
J -

I don't see what you gained. As I understand it, your objective is to enable whatever invokes the HTML file to be able to over-ride the default value of a parameter (amper variable) with a value supplied at run-time.

When the "request" is run by the html file and invokes your test.fex file ...
-* File test.fex
-SET &country = 'JAPAN';
-HTMLFORM BEGIN
<script>
parent.setCombobox1('!IBI.AMP.country;');
</script>
-HTMLFORM END

... test.fex is run on a fresh agent, so "&country=JAPAN" (even if created by -DEFAULT instead of -SET) effectively is a hard-coded constant [unaffected by the parameters that were passed to the HTML file], overriding whatever the hard-coded default was in the HTML file.

The "!IBI.AMP.country;" in test.fex refers to &country in that fex, which would be unaffected by parameters passed by whatever invoked the html file -- whereas when it is imbedded in the settings of the HTML file [as in your first screenshot] it refers to the dynamic parameter value passed into the HTML file..

- JG

This message has been edited. Last edited by: j.gross,
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Guru
posted Hide Post
Jack I was just trying to show how to get the variable in the fex to the html file. A more practical example might be if you are wanting to display future terms at an educational institution but you want the current term selected by default. If you have a view that has the current term in it that is updated based on the date, this method would allow for setting the initial selection dynamically.

I wouldn't do
 -SET &CURRENT_TERM = 'hardcodedterm' 
but rather something like
 
TABLE FILE CURRENT_TERM_VIEW
PRINT CURRENT_TERM
ON TABLE HOLD
END
-READFILE
-HTMLFORM BEGIN
<script>
parent.setCombobox1('!IBI.AMP.CURRENT_TERM;');
</script>
-HTMLFORM END
 



Francis's solution will work for this, however if there are controls chained to term, his solution won't work (at least the way I tried with oninitialupdate). The value you want will be selected, but the chaining won't happen (see last post).

This new method fixes that. It waits until the 1 px report loads and then the js is called (soon after oninitialupdate).

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


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report This Post
Guru
posted Hide Post
Does this make sense? What I am trying to show is that you can still dynamically get a value from a fex (whatever way you wish) and set the controls initially selected value to that value without having to run a fex first.

You can run the html which automatically runs the report (embedded or referenced) inside of it initially and automatically and then set the default selection.

Normally just having a hidden control poplulated by this value works just fine, but if you have chaining, the chain will not update even when using reset down chain controls:
quote:
 
function onInitialUpdate() {
	IbComposer_setCurrentSelection('combobox1', IbComposer_getCurrentSelection('edit1'), true);
	IbComposer_ResetDownChainControls('combobox1');
} 



BTW Jack, the

 
-* File test.fex
-SET &country = 'JAPAN';
-HTMLFORM BEGIN
<script>
parent.setCombobox1('!IBI.AMP.country;');
</script>
-HTMLFORM END
 


is referenced in a report frame inside the html. Test.fex is executed automatically at runtime. after it is executed, I call a function in the parent (the html composer page) to set the initial selected country to whatever country was put into &country (it doesn't have to be a hardcoded set).

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


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report This Post
Guru
posted Hide Post
Ok here is a dynamic variable example. Same htm as before, new fex:

 
-* File test.fex
-SET &time = EDIT(&TOD, '$$$$$$$9');
-SET &country = DECODE &time( 1 'ENGLAND' 2 'ENGLAND' 3 'FRANCE' 4 'FRANCE' 5 'ITALY' 6 'ITALY' 7 'JAPAN' 8 'JAPAN' ELSE 'W GERMANY' );
-HTMLFORM BEGIN
<script>
parent.setCombobox1('!IBI.AMP.country;');
</script>
-HTMLFORM END
 


Basically I am dynamically setting country based on the time (last digit). If the second is 1 then england and so on... I understand this isn't a practical report, but now the example includes a setting the controls default to a dynamic variable and it works with chaining.


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report This Post
Guru
posted Hide Post
Jack when you say parameters passed to the html, what do you mean?

-the fex will still be able to tell domain, etc.

-An initial value is also static if you use a "pre-fex"
  
-SET &country = 'England'
-htmlfom yourhtml

Then in your html file, !IBI.AMP.COUNTRY = England and not &country

With my method I am trying to demonstrate that you don't need an initial fex to be run, you can run them onload in the html file and pass the variables from there.


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report This Post
Guru
posted Hide Post
A downside to this is that if you have a large chain structure that takes a bit to load then the top value (I.E. ENGLAND) will display for a bit and then it will be populated with what you want (JAPAN or whatever). Frowner


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED]dynamic preselection &/or save selection not really getting along...

Copyright © 1996-2020 Information Builders