Focal Point
[SOLVED] App Studio - Report Procedure Firing Twice with One Button Click

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

July 17, 2015, 10:09 AM
Craig R.
[SOLVED] App Studio - Report Procedure Firing Twice with One Button Click
I have converted a v7.7.05-created HTML form to v8.1.04 (i.e., I have simply opened the form in the HTML Canvas and let App Studio do its thing). When I run the form, it presents itself looking pretty much like it did in v7.7.05 (whew!), but when I click the "run" button, the associated (external) report procedure is being executed TWICE. Ideas?

Craig

This message has been edited. Last edited by: Craig R.,


v8.1.04, 64-bit Windows (Reporting Server), Apache Tomcat (Web/App Server), HTML, PDF, AHTML, Excel outputs
July 17, 2015, 10:10 AM
MattC
Did you look at your tasks? I have seen it where I have had the same task assigned twice somehow.


WebFOCUS 8.1.05
July 17, 2015, 10:59 AM
Craig R.
Thanks, MattC, but it doesn't appear to me that they're in there twice.

Craig


v8.1.04, 64-bit Windows (Reporting Server), Apache Tomcat (Web/App Server), HTML, PDF, AHTML, Excel outputs
July 17, 2015, 02:07 PM
Rob Bowen
Have you tried commenting out the OnExecute line in the javascript that was put there in the 7.7 release?


WebFOCUS 8.1.04; SQL Server 2012; Windows 7; Windows Server 2012 R2;
July 17, 2015, 03:20 PM
Craig R.
Rob:

I think you're onto something here! Yes, I did comment-out the OnExecute line and the report did only execute once. But now I'm noticing that if my validation code that's in the run button's click event catches an error and issues an alert, the "return;" following the alert doesn't stop the report from running! I'm new to v8, so can you tell me how to "derail" a procedure from executing if you decide, in code, that it shouldn't?

Thanks,

Craig


v8.1.04, 64-bit Windows (Reporting Server), Apache Tomcat (Web/App Server), HTML, PDF, AHTML, Excel outputs
July 19, 2015, 05:02 PM
Rob Bowen
You will need to have two buttons.

The first button would be attached to run the focexec. You would then hide this button on the page.

The second button would be used to run your validation function. Your validation function, when passed, would then fire the click event on the first button.

This is the only way that I know to do your own validation at this time.


WebFOCUS 8.1.04; SQL Server 2012; Windows 7; Windows Server 2012 R2;
July 20, 2015, 07:02 AM
mrguru
Create a javascript function that if it is false will return a value other than 0. For example:


function myTest()
if (fromDate > toDate){
alert("From date(" + dateFrom + ") must be less than To date(" + dateTo + ")");
return (2);
}
return (0);
}



In your Tasks & Animations the task that isassociated with the run button - say 'Task 2' - make a javascript call to 'myTest' - then add the additional task under it to run the report.

in the request window it should look like this:

javascript call
External procedure/myReport


WF 8.2.01M
8.2.01M Reporting Server
Windows 2012 Srvr R2
PDF,Excel, HTML
Graphs - a lot of graphs
July 20, 2015, 09:09 AM
Francis Mariani
quote:
The first button would be attached to run the focexec. You would then hide this button on the page.

The second button would be used to run your validation function. Your validation function, when passed, would then fire the click event on the first button.

This is the only way that I know to do your own validation at this time.


That's a lot of fiddling in this great new world of App Studio 48.1.04...


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
July 20, 2015, 12:10 PM
Craig R.
OK, I don't know if these are the prescribed steps -- and maybe there's a shorter way -- but here's what I did, prompted by mrguru's suggestion:

1. Removed the click event for my Run button, renaming the btnRun_onclick function to btnRun_validate.

2. Changed all the return's in the validate code to return(2).

3. Removed the OnExecute(ctrl) as the last statement in btnRun_validate.

4. Added the javascript call to btnRun_validate ahead of the External procedure call in the Requests/Actions box in Tasks & Animations.

It now works! Did not appear to need a return(0) as the last statement in the btnRun_validate function, but I went ahead and put it in there...

Craig


v8.1.04, 64-bit Windows (Reporting Server), Apache Tomcat (Web/App Server), HTML, PDF, AHTML, Excel outputs
July 20, 2015, 12:18 PM
Craig R.
Agree with you, Francis! Seems like a reversal in productivity to me. Is it coincidental that going from Windows 7 to Windows 8 felt the same? Will we be returning to "normal" with WebFOCUS 10??

Craig


v8.1.04, 64-bit Windows (Reporting Server), Apache Tomcat (Web/App Server), HTML, PDF, AHTML, Excel outputs