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     [CLOSEDJava Script synchronized to excute one fex prior to the balance being complete

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSEDJava Script synchronized to excute one fex prior to the balance being complete
 Login/Join
 
Member
posted
I am attempting to create a java script that would work with Webfocus 8.1 v5 that would work with an onclick event, however I need for a specific process to complete first then the balance of the processes.

I have the following code that works for me, however I need for the highlighted line to complete and then the following events to complete. This panel is notifying my user that I am processing their request. Since there are so many reports being populated at one time it takes approximately 25 seconds for this to complete. Because there is no change in the screen, the user doesn’t realize that the processes are working unless I add in the alert that is commented out. However we do not want to have to answer the alert .

Is there anyway I can get this to work?


if(typeof(bRuntime) != 'undefined') {
// TODO: Add your inline runtime code here
}
//Begin function window_onload
function window_onload() {
window.resizeTo(1920,1000);
IbComposer_showHtmlElement('pnlMain', false );
IbComposer_showHtmlElement('pnlLoading', true );
IbComposer_showHtmlElement('pnlProcessing', false );
UpdateData();
// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload
//Begin function onInitialUpdate
function onInitialUpdate(){
IbComposer_showHtmlElement('pnlMain', true );
IbComposer_showHtmlElement('pnlLoading', false );
}
//Begin function edtFieldbbTicker_onkeypress
function edtFieldbbTicker_onkeypress(event) {
var eventObject = event ? event : window.event;
var ctrl = eventObject.target ? eventObject.target : eventObject.srcElement;
// TODO: Add your event handler code here
if (event.keyCode == 13)
{
// For Enter.
// Your function here.

IbComposer_showHtmlElement('pnlProcessing', true ); //(needs to complete first then move forward)
//alert('button processing');
IbComposer_execute('report14', 'report14');
IbComposer_ResetDownChainControls('edtFieldbbTicker');
IbComposer_execute('report1', 'report1');
IbComposer_execute('report2', 'report2');
IbComposer_execute('report3', 'report3');
IbComposer_execute('report4', 'report4');
IbComposer_execute('report5', 'report5');
IbComposer_execute('report6', 'report6');
IbComposer_execute('report7', 'report7');
IbComposer_execute('report8', 'report8');
IbComposer_execute('report9', 'report9');
IbComposer_execute('report10', 'report10');
IbComposer_execute('report11', 'report11');
IbComposer_execute('report12', 'report12');
IbComposer_showHtmlElement('panelComments', false );
IbComposer_showHtmlElement('panelTickerInfo', false );
IbComposer_showHtmlElement('panelblank', false );
IbComposer_showHtmlElement('pnlProcessing', false );
if (IbComposer_getComponentById('inputhiddenFieldbbTicker').value == '' )
{
IbComposer_showHtmlElement('panelComments', true );
IbComposer_showHtmlElement('panelTickerInfo', true );
IbComposer_showHtmlElement('panelblank', true );
alert('Invalid Ticker, Try agian');
}
IbComposer_getComponentById('pnlMain').focus();
}
}

//End function edtFieldbbTicker_onkeydown

This message has been edited. Last edited by: <Emily McAllister>,


Web Focus 8.1 v5
Windows 7
Excel, HTML, PDF
 
Posts: 4 | Registered: August 22, 2016Report This Post
Expert
posted Hide Post
Always put code that's posted to the forum within code tags (click on the </> icon).

[code]
your code here
[/code]


I assume the highlighted line is commented with //needs to complete. I cannot figure out what's going on in here, but if it's an external program of some kind, I would trigger the "balance of the processes" from that program, referencing components using parent. or window.parent. or whatever works...


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
Master
posted Hide Post
I think I see what is going on here.

Nena is using the IbComposer_showHtmlElement() function to switch on a hidden Panel box with the message "Processing" in it before running a bunch of reports.

The problem is that nothing changes in the Processing message while all those reports run. So the user doesn't know what is happening (To the user, it might seem that something has gone wrong).

I have a way to display a rudimentary progress bar using just the App Studio components, but it will only work if all those IbComposer_execute() calls run sequentially (i.e., they can't all be running at the same time).

Nena, do you know if each report finishes before the next one begins? The IBI documentation doesn't say.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Virtuoso
posted Hide Post
A couple of general remarks to make things easier on everybody:

Indent your javascript code for every level of opening/closing accolades. That makes it much easier to see where blocks of code belonging to the same function or condition begin and end. I know the code template that IBI generates in App Studio (or Dev Studio) doesn't do this, but that doesn't mean you have to follow lead. In fact, I am under the impression that their lack of proper indentation is due to the way they generate HTML pages from their templates (or whatever is behind that) and that those templates may in fact contain indentation.

Secondly, aim to make a single function only perform a single task. In your event handler above, you're hiding multiple components, then you do some processing and then you show them again. Put those separate tasks into separate functions, turning those operations into a single function call in the event handler.

Once your scripts grow to a size of any significance, put them in a separate .js file (or several files even) that you include. Those files are easy to edit in external editors, for example, and if you design them well they can even be reused in other html pages.

Now to get back to the core of the issue; what type of HTML components are 'report1' to 'report12'? I'm guessing they are (i)frames, in which case they will fire an onload event when they complete loading.
With that in mind, you could attach an event handler function that checks whether all 12 reports fired their event yet. When the last report fires its onload event, you can hide the 'pnlProcessing'-related elements.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Master
posted Hide Post
Wep,

I do exactly what you are describing with interrogating the Ready state of the Iframe to identify whether a report has finished running, then firing off post processing once its done. It has worked well for the last year and a half since I implemented it. One word of warning. The initial change of the frame in general is IBI setting the loading frame to the IFrame. So the first "Complete" Status you get might not be for the report itself. I put in a loop to test for X amount of occurrences before I went on to my second step. Also the other thing I noticed is that IE (I think it was IE... might have been specifically IE 8 or 9.... its been a while), had a different amount of times it would cycle through the states. So for one browser I had to check for the 3rd occurrence and the others I had to check for the 2nd. So If you do end up going this route, make sure to check for how many times the IFrame "Completes".


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Member
posted Hide Post
quote:
Originally posted by Squatch:
I think I see what is going on here.

Nena is using the IbComposer_showHtmlElement() function to switch on a hidden Panel box with the message "Processing" in it before running a bunch of reports.

The problem is that nothing changes in the Processing message while all those reports run. So the user doesn't know what is happening (To the user, it might seem that something has gone wrong).

I have a way to display a rudimentary progress bar using just the App Studio components, but it will only work if all those IbComposer_execute() calls run sequentially (i.e., they can't all be running at the same time).

Nena, do you know if each report finishes before the next one begins? The IBI documentation doesn't say.




Squatch,
You are correct, and the following calls do run sequentially.

thanks
Nena


Web Focus 8.1 v5
Windows 7
Excel, HTML, PDF
 
Posts: 4 | Registered: August 22, 2016Report This Post
Member
posted Hide Post
quote:
Originally posted by Nena Etheridge:
quote:
Originally posted by Squatch:
I think I see what is going on here.

Nena is using the IbComposer_showHtmlElement() function to switch on a hidden Panel box with the message "Processing" in it before running a bunch of reports.

The problem is that nothing changes in the Processing message while all those reports run. So the user doesn't know what is happening (To the user, it might seem that something has gone wrong).

I have a way to display a rudimentary progress bar using just the App Studio components, but it will only work if all those IbComposer_execute() calls run sequentially (i.e., they can't all be running at the same time).

Nena, do you know if each report finishes before the next one begins? The IBI documentation doesn't say.




Squatch,
You are correct, and the following calls do run sequentially.

thanks
Nena


I just re read your comment, they do run sequentially, however nothing is displayed until all are finished.

Thus, my issue, I need the first to run and complete until I turn that panel off, after the reports have ran.

I hope this clears up my issue. Sorry I didn't respond quicker, I was pull into another project that had to be completed before this one.


Web Focus 8.1 v5
Windows 7
Excel, HTML, PDF
 
Posts: 4 | Registered: August 22, 2016Report This Post
Virtuoso
posted Hide Post
quote:
I need the first to run and complete until I turn that panel off, after the reports have ran.


From the above I do not understand in what order you need things to happen. I'm probably not alone in that. Perhaps you could turn above statement into a list of subsequent steps that you need to happen? Preferably with the inclusion of which IbComposer_execute calls go with those steps?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Member
posted Hide Post
quote:
Originally posted by Wep5622:
quote:
I need the first to run and complete until I turn that panel off, after the reports have ran.


From the above I do not understand in what order you need things to happen. I'm probably not alone in that. Perhaps you could turn above statement into a list of subsequent steps that you need to happen? Preferably with the inclusion of which IbComposer_execute calls go with those steps?


I am using AppStudio, with a onkeypress event.

when the user presses enter I need for the java script call to execute in the following order.


1. IbComposer_showHtmlElement('pnlProcessing', true );
This is the processing panel to be shown to the user. This will need to complete first then the following reports will need to be completed

2. IbComposer_execute('report14', 'report14');
This report takes the users entry and breaks it into the variables used in the sequential reports.

3. IbComposer_ResetDownChainControls('edtFieldbbTicker');
This sets all the variables for the following 12 reports

4. IbComposer_execute('report1', 'report1');
IbComposer_execute('report2', 'report2');
IbComposer_execute('report3', 'report3');
IbComposer_execute('report4', 'report4');
IbComposer_execute('report5', 'report5');
IbComposer_execute('report6', 'report6');
IbComposer_execute('report7', 'report7');
IbComposer_execute('report8', 'report8');
IbComposer_execute('report9', 'report9');
IbComposer_execute('report10', 'report10');
IbComposer_execute('report11', 'report11');
IbComposer_execute('report12', 'report12');

5. IbComposer_showHtmlElement('panelComments', false );
This is another panel that is removed to allow the user to add comments to a specific report.

6. IbComposer_showHtmlElement('panelTickerInfo', false );
This is a panel that reveals all the variables once turned off.

7. IbComposer_showHtmlElement('panelblank', false );
This is the panel that reveals all 12 reports once turned off.

8. IbComposer_showHtmlElement('pnlProcessing', false );
This is the panel that shows the hidden "PROCESSING" panel


(CONDITION IN PLACE TO VERIFY A VALID ENTRY IS GIVEN)
if (IbComposer_getComponentById('inputhiddenFieldbbTicker').value == '' )
{
IbComposer_showHtmlElement('panelComments', true );
IbComposer_showHtmlElement('panelTickerInfo', true );
IbComposer_showHtmlElement('panelblank', true );
alert('Invalid Ticker, Try agian');
}
IbComposer_getComponentById('pnlMain').focus();
}
}

//End function edtFieldbbTicker_onkeydown

I would like to thank everyone for your help with this


Web Focus 8.1 v5
Windows 7
Excel, HTML, PDF
 
Posts: 4 | Registered: August 22, 2016Report This Post
Master
posted Hide Post
I don't know if this will work with your WebFOCUS system, but try saving this to an HTML file and running it:

<!DOCTYPE html>
<HTML><HEAD>
<META content=IE=Edge http-equiv=X-UA-Compatible>
<META name=mycharsetmeta content="text/html; charset=WINDOWS-1252" http-equiv=Content-Type>
<META name=Generation content="Created in release 8105, Generation 4">
<META name=viewport content="width=device-width, initial-scale=1.0"><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><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");}</script><TITLE>HtmlPage</TITLE>
<SCRIPT type=text/javascript>
//confidential_id=clientEventHandlersJS
if(typeof(bRuntime) != 'undefined') {
// TODO: Add your inline runtime code here
}
function window_onload() {
    UpdateData();
    hide_pnlProgressBar();
    setTimeout(run_reports,200);
}
// Global variables. These should not be inside any function!
var number_of_reports_to_run = 4;
var reports_run_so_far = 0;
function run_reports() {
    // Simulate running reports that take some time to finish.
    // Then update the "progress bar".
    show_pnlProgressBar();
    setTimeout(update_progress_bar, 0);
    setTimeout(update_progress_bar, 3000);
    setTimeout(update_progress_bar, 8000);
    setTimeout(update_progress_bar, 11000);
}
function hide_pnlProgressBar() {
    // Hide pnlProgressBar
    document.getElementById("pnlProgressBar").style.visibility = "hidden";
}
function show_pnlProgressBar() {
    // Show pnlProgressBar
    document.getElementById("pnlProgressBar").style.visibility = "visible";
}
function update_progress_bar() {
    reports_run_so_far++;
    var percent_complete = (reports_run_so_far / number_of_reports_to_run) * 100;
    document.getElementById("pnlProgressBar").style.width = percent_complete + "%";
}

</SCRIPT>

<STYLE>.internal_default {
	
}
#pnlBox {
	POSITION: absolute; BACKGROUND-COLOR: white; MARGIN: auto; WIDTH: 100px; BOTTOM: 0px; HEIGHT: 100px; RIGHT: 0px; TOP: 0px; LEFT: 0px
}
</STYLE>
<!--//confidential_id=focus_xmlelement
<rootxmlnode focoption="_FOC_NULL"><html_elements><html_body use_appl_css="no" maptype="0" autofitchildren="no" mobiledocument="no" thumbnailscale="4" edaconnectionrequired="false" ibiapp_app="bidev" ismre="1" ibif_ex="/WFC/Repository/BIDEV/~sharpet/wf_forum_processing_message.htm"><html_event eventname="load" eventhandlername="window_onload"/><layer name="default"/></html_body><html_element bindcontrolid="pnlBox" layername="default" elementtype="34" myviewonautofit="dontyouever" autofitchildren="no" containerdisplayas="child" controltype="7"><data_info/></html_element><html_element bindcontrolid="labelText" layername="default" elementtype="50" myviewonautofit="dontyouever" controltype="7"><data_info/></html_element><html_element bindcontrolid="pnlProgressBar" layername="default" elementtype="34" myviewonautofit="dontyouever" autofitchildren="no" containerdisplayas="child" controltype="7"><data_info/></html_element><html_element rtFileName="htmlpathsub/javaassist/ibi/html/composer/themes/nonBindows/IBI-Themes/default_theme.css" bindcontrolid="LINK3" type="cssfile"/><html_element rtFileName="htmlpathsub/javaassist/ibi/html/composer/themes/nonBindows/IBI-Themes/ibi.css" bindcontrolid="IBI_THEME_CSS" desc="Information Builders" type="cssfile"/></html_elements><variables></variables><requests></requests><tasks><task id="load" trigger="load"/></tasks><animations></animations></rootxmlnode>
--><script type="text/javascript">
//confidential_id=updateHeadElements
if(typeof updateHeadElements === 'function'){updateHeadElements();}</script></HEAD>
<BODY class=IBI_PageBg>
<DIV style="Z-INDEX: 1; POSITION: absolute; MARGIN: auto; WIDTH: 350px; HEIGHT: 140px; TOP: 0px; LEFT: 0px" id=pnlBox class="IBI_Panel IBI_rounded_m internal_default" tabIndex=-1><LABEL style="Z-INDEX: 1; POSITION: absolute; TEXT-ALIGN: center; WIDTH: 100%; HEIGHT: 50%; FONT-SIZE: 4em; CURSOR: default; TOP: 0px; LEFT: 0px" id=labelText class="IBI_ReportControlLabel internal_default" tabIndex=-1>Main 
</LABEL>
<DIV style="BACKGROUND-IMAGE: none; Z-INDEX: 2; POSITION: absolute; BACKGROUND-COLOR: rgb(0,0,255); WIDTH: 0%; HEIGHT: 50%; TOP: 50%; LEFT: 0px" id=pnlProgressBar class="IBI_Panel IBI_rounded_m internal_default" tabIndex=-1></DIV></DIV></BODY><script type="text/javascript">
//confidential_id=IBI_loader
if(typeof doBeforeLoad === 'function'){doBeforeLoad();}function AdjustChildrenPosition(){
}
</script></HTML>


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report 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     [CLOSEDJava Script synchronized to excute one fex prior to the balance being complete

Copyright © 1996-2020 Information Builders