Is it possible to launch a 2nd IE session with a message in it?
Hi,
When we submit our reports to HMTL output or Excel output a new window is launched which the data will be displayed in.
We would like to launch a second IE window with a message if the report has returned more than X number of rows.
I have coded a check on &LINES at the end of the report, and if the requirement is met I wish to output the following:
-HTMLFORM BEGIN Report ABC ran for more than X minutes. Please contact xxx. -HTMLFORM END
However this does not create 2nd window, it just appends the message to the bottom of the report results. Is there any way to launch a 2nd window?
WebFocus 765. iSeries v5r4
April 26, 2007, 11:08 AM
Francis Mariani
Here's one way to do it (Change the value of the DM variable &THRESHOLD to a number less than 5 or greater than 4 to see the difference in message/no message behaviour):
-SET &THRESHOLD = 3;
TABLE FILE CAR
SUM
SALES
BY COUNTRY
END
-RUN
-SET &NB_LINES = &LINES;
-SET &ONLOADFUNC = IF &NB_LINES GT &THRESHOLD THEN 'DisplayMsg1();' ELSE '';
-HTMLFORM BEGIN
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
function DisplayMsg1()
{
var vWinFeatures = "height=50,width=300,left=45,top=45,menubar=no,toolbar=no,status=yes,resizable=yes,scrollbars=yes";
winMsgWindow = window.open("","winMsgWindow", vWinFeatures);
winMsgWindow.document.writeln('the report has returned more than !IBI.AMP.THRESHOLD; number of rows');
}
</SCRIPT>
</HEAD>
<BODY onload="!IBI.AMP.ONLOADFUNC;">
</BODY>
</HTML>
-HTMLFORM END
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
April 26, 2007, 11:29 AM
BlueZone
We too could use this simple, yet fine example Francis, Thank you. And Thx to you too Mark, for asking the Q.
Sandeep Mamidenna
------------------------------------------------------------------------------------------------- Blue Cross & Blue Shield of MS WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !!
April 26, 2007, 11:46 AM
Francis Mariani
After the second window is opened with the window.open JS, the html inside the new window can be as elaborate as you want, just add more document.writeln JS commands.
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
April 27, 2007, 04:12 AM
mark66
Thanks Francis, that's great. However it only appears to work when the output is for HTML, when outputting to Excel or PDF, it does not launch the message window? Will this be possible?
At the end of all our reports, we make a call to a 'INCLUDE FINISH'. This program updates a log file with some runtime stats, such as endtime, rows returned etc. It is at the top of this program that I have placed your code. Does it need to be moved?
-HTMLFORM BEGIN
<HTML>
<HEAD>
<script language="JavaScript">
function DisplayMsg1()
{
var vWinFeatures = "height=50,width=300,left=45,top=45,menubar=no,toolbar=no,status=yes,resizable=yes,scrollbars=yes";
winMsgWindow = window.open("","winMsgWindow", vWinFeatures);
winMsgWindow.document.writeln('the report has returned more than !IBI.AMP.THRESHOLD; number of rows');
}
</SCRIPT>
</HEAD>
<BODY onload="!IBI.AMP.ONLOADFUNC;">
</BODY>
</HTML>
-HTMLFORM END
Many thanks
MarkThis message has been edited. Last edited by: mark66,
WebFocus 765. iSeries v5r4
April 27, 2007, 09:22 AM
susannah
mark, you need to put code tags around the html in your post, otherwise we can't read it all. -s francis, applause. another T.O.T.Y. award! f, how would i get a window name on that little pop up? In an ordinary html page, i would use the
<title>page title here </title>
in the head section of the htmlform. I would like to give a nicer title to this pop up window than the default server name..etc.This message has been edited. Last edited by: susannah,
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
April 27, 2007, 10:11 AM
smiths
Susannah,
This works when you add the following line to Francis' script:
winMsgWindow.document.write('<HTML><TITLE>page title here</TITLE></HTML>');
Regards, Sean
------------------------------------------------------------------------ PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
April 27, 2007, 10:14 AM
TexasStingray
Here is what I would suggest. Using a combination of JavaScript and WebFOCUS code. Run the Report and hold it to a temp location that gets cleand up say after x number of hours. Then at the end of the report where you check &LINE if you want to open a message windows then put a button on it that says something like "Display Report" at which time you call and display the saved report file. else you just display the saved report file.
Scott
April 27, 2007, 10:19 AM
susannah
is that ever great! thanks Sean, and applause to all 3 of you.
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
April 27, 2007, 10:30 AM
mark66
quote:
Originally posted by susannah: mark, you need to put code tags around the html in your post, otherwise we can't read it all...
Done
Texas, that does sound like a good suggestion, but for the moment we still want to launch this second window if possible. I just need to know how to make it happen when outputting to a format other than HTML?
WebFocus 765. iSeries v5r4
April 27, 2007, 10:36 AM
TexasStingray
If you your output is HTML then you would have to use the code provided. If the output is EXCEL then you would have to use an excel template and code a macro to diaplsy a message. If the output is PDF I don't know what you would have to do it there is anything. My Suggestion above would work for what ever your output format is.
Scott
April 27, 2007, 10:50 AM
susannah
If you're able to grab the computername of the user ( i don't know how to do that..but there must be a way) then CMD NET SEND computername YOUR MESSAGE HERE -RUN sends an alert box to the computername and can be sent mid-fex and doesn't involve an HTMLFORM effectively stopping the processing. You would issue it after your extract file and before your final file preparation (whatever format) Our network is cisco and our server win2k or win2k3, if that helps. I use this command with my own computername hardcoded in it to alert me to some things my users are doing. kinda sneaky.
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID