Focal Point
[CLOSED] How to Get WebFocus Source Code below the Report?

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

June 03, 2011, 02:40 AM
Mayank Agrawal
[CLOSED] How to Get WebFocus Source Code below the Report?
Hi All,
I want to display the executed source code used to generate the report,below the report in a separate message box. How can i achieve this ?

Please help me.

Thanking You Guys......!!

This message has been edited. Last edited by: Kerry,


7.6.11, Windows
Excel, HTML,PDF
June 03, 2011, 05:07 AM
GamP
With a little searching and creative thinking on your part, you can figure out a way to do that. You'll need to switch on user tracing, run the report and hold it, switch off tracing, process the trace file, hold it, and then present the resulting page.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
June 03, 2011, 06:05 AM
<JG>
/.1.1 and up

quote:
Syntax: How to Use the Message Viewer
Add the following WFServlet variable to your URL call for WebFOCUS:

IBIWF_msgviewer=optionwhere:

option

Is one of the following:


OFF

Disables the Message Viewer. When this option is disabled, you can still view informative messages or error messages for HTML reports from the view source option in your browser.

ON

Displays messages in a separate browser window.

ECHOON

Displays messages and lines in a separate browser window that are expanded and stacked for execution.

ECHOALL

Displays messages and lines in a separate browser window that are expanded and stacked for execution while also displaying all Dialogue Manager commands.

Note: The ON, ECHOON, and ECHOALL options are available for all output formats including HTML and PDF


If running from dev studio you can turn it on by using the option on the run button
If running from a launch page add it as a hidden input variable
June 03, 2011, 06:38 AM
Lucas
Place the source code in a database and query it out as needed. Then you can put it anywhere you like on any report.....


7.6.6 Mainframe
7.6.4 Web Focus
Windows

June 03, 2011, 09:10 AM
dlogan
To reiterate some things other people have said.

Adding ECHO=ALL will display the source code as a hidden comment at the end of the report.

If you want to actually display this content, you should be able to use JavaScript to walk the DOM and extract that portion of the page and insert it into a Text box.


WF 71.x, 76.x, 7701, 8.0 Beta OS: Linux, Win2k3, Win2k, Win2k8, WinXP


June 03, 2011, 09:14 AM
Mayank Agrawal
quote:
Originally posted by JG:
/.1.1 and up

quote:
Syntax: How to Use the Message Viewer
Add the following WFServlet variable to your URL call for WebFOCUS:

IBIWF_msgviewer=optionwhere:

option

Is one of the following:


OFF

Disables the Message Viewer. When this option is disabled, you can still view informative messages or error messages for HTML reports from the view source option in your browser.

ON

Displays messages in a separate browser window.

ECHOON

Displays messages and lines in a separate browser window that are expanded and stacked for execution.

ECHOALL

Displays messages and lines in a separate browser window that are expanded and stacked for execution while also displaying all Dialogue Manager commands.

Note: The ON, ECHOON, and ECHOALL options are available for all output formats including HTML and PDF


If running from dev studio you can turn it on by using the option on the run button
If running from a launch page add it as a hidden input variable



I hace already done that .. what evere u are saying . bit not getting the expected result.
What to do ?


7.6.11, Windows
Excel, HTML,PDF
June 03, 2011, 12:14 PM
Michael Bee
Depends:

...if you're looking for devstudio feedback -- there's a dropdown next to the run button -click 'message viewer on'(for just -TYPE statements) or 'Display Command Lines'(for all code).

If you're looking for all code in browser 'view/source'...


7.6.10, Winddows X64
all output
June 04, 2011, 02:10 PM
dlogan
The following is an example of the technique I was talking about:

-SET &ECHO=ALL;
TABLE FILE CAR
BY COUNTRY
END
-SET &ECHO=OFF;
-HTMLFORM BEGIN
<SCRIPT>
function getSource(ob){
  var content = document.body.lastChild.textContent;
  var sEnd = content.indexOf("amp;ECHO=OFF;") - 6;
  ob.contentDocument.write('<PRE>' + content.substring(0, sEnd) + '</PRE>');
}
</SCRIPT>
<IFRAME src="about:blank" onload="getSource(this);"></IFRAME>
-HTMLFORM END



WF 71.x, 76.x, 7701, 8.0 Beta OS: Linux, Win2k3, Win2k, Win2k8, WinXP


June 04, 2011, 02:10 PM
dlogan
The above technique works in Firefox, when I have time I'll play around with making it work in IE.


WF 71.x, 76.x, 7701, 8.0 Beta OS: Linux, Win2k3, Win2k, Win2k8, WinXP


June 04, 2011, 05:57 PM
<FreSte>
Suppose there are no command-tags besides the one WebFOCUS adds at the end, for IE you can use this:

-SET &ECHO=ALL;
TABLE FILE CAR
BY COUNTRY
END
-SET &ECHO=OFF;
-HTMLFORM BEGIN
<html>
<script>
function getSource() {
  var _commentTags = document.getElementsByTagName("!");
  alert(_commentTags[0].innerHTML);
}
</script>
<body onload='getSource();'>
</body>
</html>
-HTMLFORM END

June 06, 2011, 10:02 AM
dlogan
The following code works in Firefox & IE.

-SET &ECHO=ALL;
TABLE FILE CAR
BY COUNTRY
END
-SET &ECHO=OFF;
-HTMLFORM BEGIN
<SCRIPT>
function getSource(ob){
  var content = document.body.lastChild.nodeValue;
  var sEnd = content.indexOf("amp;ECHO=OFF;") - 6;
  ob.contentWindow.window.document.write('<PRE>' + content.substring(0, sEnd) + '</PRE>');
}
</SCRIPT>
<IFRAME src="about:blank" onload="getSource(this);"></IFRAME>
-HTMLFORM END



WF 71.x, 76.x, 7701, 8.0 Beta OS: Linux, Win2k3, Win2k, Win2k8, WinXP


June 06, 2011, 10:55 AM
Francis Mariani
Very interesting, dlogan!


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
June 06, 2011, 11:19 AM
dlogan
For even more fun, the following puts the source code into a TEXTAREA window which can be edited, and a button has been added which allows you to rerun the modified source code.

-SET &ECHO=ALL;
TABLE FILE CAR
BY COUNTRY
END
-SET &ECHO=OFF;
-HTMLFORM BEGIN
<div id='sourceViewer'>
<SCRIPT>
function getSource(ob){
  var content = document.body.lastChild.nodeValue;
  var sEnd = content.indexOf("amp;ECHO=OFF;") - 6;
  ob.contentWindow.window.document.write('<textarea id="ta" style="height:100%;width:100%;">' + content.substring(0, sEnd) + '</textarea>');
}
function rerun(){
  var objDoc = sourceCode.document ? sourceCode.document : sourceCode.contentDocument;
  var code = objDoc.getElementById("ta").value;
  var sourceViewer = document.getElementById("sourceViewer").innerHTML;
  var adhocfex = "-SET " + "&" + "ECHO=ALL;\n" + code + "\n-SET " + "&" + "ECHO=OFF;\n-HTMLFORM BEGIN\n <div id='sourceViewer'>\n" + sourceViewer + "\n</div>\n-HTMLFORM END\n";
  document.getElementById("IBIF_adhocfex").value = adhocfex;
  return true;
}
</SCRIPT>
<IFRAME id="sourceCode" src="about:blank" onload="getSource(this);" frameBorder="0"></IFRAME><br />
<FORM action="/ibi_apps/WFServlet" method="POST" onsubmit="return rerun()">
  <INPUT type="hidden" id="IBIF_adhocfex" name="IBIF_adhocfex" >
  <INPUT type="submit" value="Rerun">
</FORM>
</div>
-HTMLFORM END



WF 71.x, 76.x, 7701, 8.0 Beta OS: Linux, Win2k3, Win2k, Win2k8, WinXP


June 06, 2011, 11:42 AM
Francis Mariani
Crazy, man, crazy!


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
June 06, 2011, 01:11 PM
FrankDutch
I am going to try this tomoorow .
the idea looks interesting




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7