Focal Point
[SOLVED] HTML Composer: IbComposer_setCurrentSelection - how to make it work?

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

October 15, 2012, 06:16 PM
Francis Mariani
[SOLVED] HTML Composer: IbComposer_setCurrentSelection - how to make it work?
I have two windows. From window two I want to affect a control in window one, hopefully using the function IbComposer_setCurrentSelection.

I cannot get it to work.

Using normal JavaScript works:
parent.opener.document.getElementById('SAVE_REPORT_NAME').value = varSAVE_REPORT_NAME;

Using IbComposer_setCurrentSelection does not work:
parent.opener.IbComposer_setCurrentSelection(parent.opener.document.getElementById('SAVE_REPORT_NAME'),varSAVE_REPORT_NAME);

varSAVE_REPORT_NAME is a JS variable containing the value I want to update the control with. I get no error but nothing happens.

Any ideas?

Thanks,

This message has been edited. Last edited by: Francis Mariani,


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
October 15, 2012, 06:31 PM
Francis Mariani
In file C:\ibi\WebFOCUS77\ibi_html\javaassist\ibi\html\js\ib_composer_api.js I found this:

//selects values in the control// arrValues is the array of values to be selected not done yet

function IbComposer_setCurrentSelection(controlId, arrValues, bUpdateDependencies)
{
    setCurrentSelection(controlId, arrValues, bUpdateDependencies);
}

I certainly hope that "not done yet" doesn't mean the function is non-functional yet (as at v7.7.03)...

As per the documentation, I tried putting the value in an array, but that didn't work either.


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
October 15, 2012, 07:26 PM
Francis Mariani
I put an alert in function IbComposer_setCurrentSelection in file ib_composer_api.js and I get nothing - seems like it does not get called?!


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
October 15, 2012, 09:54 PM
StuBouyer
Francis,

I believe part of your problem is that you are passing a control to the function rather than the unique ID (string value).

Try changing your function to:

parent.opener.IbComposer_setCurrentSelection('SAVE_REPORT_NAME',varSAVE_REPORT_NAME); 


Also is opener a HTML document in a frame in the parent HTML?

Cheers

Stuart


WebFOCUS 8.2.03 (8.2.06 in testing)
October 15, 2012, 11:56 PM
Dan Satchell
I found certain requirements to make IbComposer_setCurrentSelection work, which I mention about two-thirds of the way through this earlier post.


WebFOCUS 7.7.05
October 16, 2012, 09:27 AM
Francis Mariani
Dan, thanks very much for the information - I will take a look later this evening.


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
October 16, 2012, 10:07 AM
David Glick
The 7703 manual shows that the API function takes 'controlID' in the syntax and explains that 'controlID' is the unique identifier of the control from which values are obtained.

Additionally, the "Not done yet" comment in the JS file means that these values have not been obtained yet.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
October 17, 2012, 08:57 PM
Francis Mariani
I corrected my faulty code and this line now works - it sets the value of a text field:

parent.opener.IbComposer_setCurrentSelection('SAVE_REPORT_NAME',SAVE_REPORT_NAME);


The next thing I'm trying to work out is how to call IbComposer_setCurrentSelection to set two very particular double-list boxes - one is a list of report dimension (sort by) column names and the other is a list of measure column names. The IbComposer_getCurrentSelection function on these two double-list boxes returns something like "COUNTRY BY MODEL BY CAR" AND "SALES AND WEIGHT AND LENGTH", respectively. To use these values in IbComposer_setCurrentSelection, based on the documentation, the values must be in an array - so I stripped out the BY and AND and created arrays. When I assign these arrays to the IbComposer_setCurrentSelection, the double-lst boxes do not get set.

Are these two types of double-list boxes too specialized?


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
October 19, 2012, 01:14 PM
Francis Mariani
Solved!

I was not calling the function properly - it works very well for a variety of control types, in fact IbComposer_getCurrentSelection and IbComposer_setCurrentSelection are great functions. In the past, I had developed something similar to what I'm doing now, but with traditional JavaScript, with which I had to treat each control type differently - radio buttons, list boxes, double list boxes, etc. With IbComposer_getCurrentSelection and IbComposer_setCurrentSelection, you don't have to worry about the control type - as long as you have the value(s) - they just work.

My thanks to tech support.


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
October 19, 2012, 01:25 PM
MAdams1
Barry is great! I was feeling very sad for how frustrated you were. Glad to hear you are now touting this wonderful toolSmiler


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
October 19, 2012, 02:48 PM
Francis Mariani
Barry is wonderful. The tool is great and can be made better!

This message has been edited. Last edited by: Francis Mariani,


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