Focal Point
[REOPENED] HTML Composer: IbComposer_execute - anyone make this function work?

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

October 14, 2012, 05:35 PM
Francis Mariani
[REOPENED] HTML Composer: IbComposer_execute - anyone make this function work?
I followed the example on page 313 of the Designing a User Interface for a Web Application With the HTML Composer manual, Version 7 Release 7.03 and I cannot get IbComposer_execute to work.

I added a button to a blank HTML page. I created an onclick event. I added execution of IbComposer_execute in the function for this event. Saved the file. Ran the file. Clicked the button - nothing happens.

//Begin function button1_onclick
function button1_onclick(ctrl) {
IbComposer_execute('dummyabc');
}
//End function button1_onclick

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, 08:51 AM
MattC
Yes, I was able to get this to work. I am actually getting the values and storing them into a hidden textarea, then I pass those values into a report fex that get executed.

 //Begin function listbox2_onclick
function listbox2_onclick(ctrl) {

var values = IbComposer_getCurrentSelection('listbox2');

document.getElementById('textarea1').innerHTML=""+values;

IbComposer_execute('report1', 'report1');
}
//End function listbox2_onclick 



WebFOCUS 8.1.05
October 15, 2012, 04:45 PM
j.gross
The manual is rather terse:

Syntax: How to Execute a Report or Chart

IbComposer_execute('reportID', ['outputTarget']);

where:

reportID
Alphanumeric

Is the unique identifier of the report or chart to execute.

outputTarget
Alphanumeric

Is the optional parameter to set the target of the output. Is one of the following:
■ The name of a frame.
■ '_blank'.
■ '_target'.
■ The name of a new window.

--------------------------------------------------------------------------------

Example: Executing a Report in a New Window

function button3_onclick(ctrl) {
IbComposer_execute('report1', 'newwin');
}



It's clear that reportID is supposed to be the ID attribute of a 'report' or 'chart' object, something locatable in the HTML DOM (as opposed to, say, the name of a fex that ultimately produces the output), and displayable/modifiable in the properties box of an object. Someone please explain, exactly what kind of object is that?
October 15, 2012, 04:58 PM
j.gross
quote:
I added a button to a blank HTML page. I created an onclick event. I added execution of IbComposer_execute in the function for this event. Saved the file. Ran the file. Clicked the button - nothing happens.


The first argument of IbComposer_execute() is supposed to be the "unique identifier" (ID attribute in the property box) of a "report" or "chart" object that you have added to the page -- which would thus, in the generated code, be an ID attribute that javascript functions can locate in the DOM.

Not clear to me how to insert into a launch page a "report", that I expect to open in a new window, without its taking up real-estate on the launch page.

But if the identifier value you code is nothing more that the name of a fex, it cannot operate.
October 19, 2012, 01:15 PM
Francis Mariani
I misread the documentation - it clearly states what the function is designed to do.


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
November 05, 2012, 02:28 PM
Francis Mariani
How does one determine the "the unique identifier of the report or chart to execute"?

I can't see any id in this line of code:

<request requestid="5" sourcetype="typeFex" targettype="iframe" targetname="iframe2" ibif_ex="app/report1.fex" IBIMR_domain="manageme/manageme.htm" IBIMR_folder="#blahblahblah" IBIMR_sub_action="MR_STD_REPORT" activereport="0" reportcolumns="" reportrealcolumns="" ibiapp_app="management"></request>


Do I specify the id of the target frame?


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
November 05, 2012, 02:41 PM
Severus.snape
Yes Francis,

The iframe 'name' attribute needs to be passed as a param to execute the request.
I got this working in a couple of reports.


  
function radio1_onclick(ctrl) {

 
 
// TODO: Add your event handler code here
//OnExecute(ctrl)
IbComposer_execute('graph1');
IbComposer_execute('graph2');
IbComposer_execute('graph3');
}




thanks
Sashanka


WF 7.7.03/Windows/HTML,PDF,EXL
POC/local Dev Studio 7.7.03 & 7.6.11
November 05, 2012, 03:01 PM
Francis Mariani
Very confusing:

quote:
Function: IbComposer_execute
How to:
Execute a Report or Chart
The IbComposer_execute function executes a report or chart.
Syntax: How to Execute a Report or Chart
IbComposer_execute('reportID', ['outputTarget']);
where:
reportID
Alphanumeric
Is the unique identifier of the report or chart to execute.
outputTarget
Alphanumeric
Is the optional parameter to set the target of the output. Is one of the following:
The name of a frame.
'_blank'.


Why the optional "name of a frame" when it's the name of the frame we must put in 'the unique identifier of the report or chart to execute'?


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
November 05, 2012, 03:54 PM
Severus.snape
Yes it is kind of redundant but we can overwrite the predefined target window/frame in the request tag with this Optional frame name...for example ...if the checked radio box is PDF then run the request in new window or run it in the same frame.

  


IbComposer_execute('graph1','new');
IbComposer_execute('graph1');


}


thanks
Sashanka


WF 7.7.03/Windows/HTML,PDF,EXL
POC/local Dev Studio 7.7.03 & 7.6.11
November 07, 2012, 12:53 AM
StuBouyer
Francis,

Have a look further up your HTML page, you'll probably see one of your FORMS or controls have the following:

requests_list="5"

That form or control is the unique ID you want for the Ibcomposer_execute function.

Regards

Stuart


WebFOCUS 8.2.03 (8.2.06 in testing)
November 07, 2012, 12:56 AM
StuBouyer
quote:
Originally posted by Francis Mariani:
Very confusing:

Why the optional "name of a frame" when it's the name of the frame we must put in 'the unique identifier of the report or chart to execute'?


The "name of the frame" is another frame that you may choose to send the report output to - over-riding the "regular" frame.

Regards

Stuart


WebFOCUS 8.2.03 (8.2.06 in testing)
November 07, 2012, 09:35 AM
Francis Mariani
Thanks for the explanations.

Sashanka, your comment about PDF is very interesting. You're suggesting we can modify the default behaviour of the Run button by deciding where to run the report depending on the selected report format. I will experiment with this, thanks.


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
December 09, 2019, 12:21 PM
iBeny
It's Funny!!!

@Francis,
We recently did an upgrade and i am currently working on the same line of code you have written in this program,i had to change the function below to fix it:
function tabSaved_onclick(ctrl)
{
// Clean up message iframe (may contain a "Saved parameters" message
$('#frmMsg').contents().find('html').html('');

// Always refresh this frame
//IbComposer_setCurrentSelection('RNDM', Math.floor(Math.random()*10000000));
document.getElementById('RNDM').value = Math.floor(Math.random()*10000000);
//if (document.getElementById('frm_saved_reports').contentWindow.document.body.innerHTML == '')
{
IbComposer_execute('frm_saved_reports','frm_saved_reports');
}
}


Had to write the IbComposer_execute('frm_saved_reports','frm_saved_reports') in place of IbComposer_execute('frm_saved_reports') to redirect the output to the Frame, else by default it was opening the frame result in the new window.

Even though the Iframe target was 'frm_saved_reports'.

This thread helped.


Webfocus 8105,8808,7703,7611, EXL2K,HTML,PDF,COMT,AHTML Info Assist+ , Reportcaster