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     [SOLVED] javascript error thru reportcaster

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] javascript error thru reportcaster
 Login/Join
 
Platinum Member
posted
I have a report similar to this one
 
DEFINE FILE CAR
RETAIL/A16=FTOA(RETAIL_COST,'(D12CM)',RETAIL);
END
TABLE FILE CAR
PRINT
-* INFLD
 COMPUTE CNT/I4=CNT+1;
 COMPUTE RETAIL_COST1/A255=RETAIL | '<INPUT type=hidden id=cost' | EDIT(CNT) | '_1 name=cost' | EDIT(CNT) | '_1 value=' | EDIT(RETAIL_COST) | '>';
 COMPUTE RETAIL_COST2/A255=RETAIL | '<INPUT type=hidden id=cost' | EDIT(CNT) | '_2 name=cost' | EDIT(CNT) | '_2 value=' | EDIT(RETAIL_COST) | '>';
 COMPUTE RETAIL_COST3/A255=RETAIL | '<INPUT type=hidden id=cost' | EDIT(CNT) | '_3 name=cost' | EDIT(CNT) | '_3 value=' | EDIT(RETAIL_COST) | '>';
 COMPUTE REBATE/A255='<INPUT type=text id=rebate' | EDIT(CNT) | ' name=rebate' | EDIT(CNT) | ' value="" onChange=projectFuture("' | EDIT(CNT) | '")>'; AS 'Rebate %'
 COMPUTE MULT_INFLD/A255='<span id=infld' | EDIT(CNT) | '>calculation</span><INPUT type=hidden id=outfld' | EDIT(CNT) | ' name=outfld' | EDIT(CNT) | ' value="")>';
 BY CAR
ON TABLE HOLD AS RPT FORMAT HTMTABLE
END

-RUN

-HTMLFORM BEGIN
<HTML>
<head>
<SCRIPT>
function projectFuture(num)
{
for (i=1; i<4; i++)
{
 var costName='cost' + num + '_'+i;
 var rebateName='rebate' + num;
 var newCost=document.getElementById(costName).value * ((100 - document.getElementById(rebateName).value) / 100);
 var idName='infld' + num;
 var outName='outfld' + num;
}
document.getElementById(idName).firstChild.nodeValue=newCost;
document.getElementById(outName).value=newCost;
}
</SCRIPT>
</HEAD>
<body>
<form action="/ibi_apps/WFServlet" method="get">
<input type="hidden" name="IBIF_ex" value="test1">
<input type="hidden" name="PART" value="UPDATE">
!IBI.FIL.RPT;
<br>
<input type="submit">
</form>
</body>
</html>
-HTMLFORM END
 

when I run it manually it looks fine, but thru reportcaster I get a javascript error whenever a text box is updated. Is there something different that needs to be done for javascript logic to work thru reportcaster?

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


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
 
Posts: 116 | Registered: April 23, 2007Report This Post
Expert
posted Hide Post
Report Caster is not a browser-based tool. What exactly do you want to do with this? Are you expecting a form to be distributed to the user to be filled out?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Platinum Member
posted Hide Post
The report gets emailed to the user, who then has the ability to calculate a cost based on a rebate value. If I run the report myself and e-mail it to the user it works fine.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
 
Posts: 116 | Registered: April 23, 2007Report This Post
Virtuoso
posted Hide Post
As Ginny says, RC is not browser-based. Javascript login does not "work" in RC. It has no concept of HTMLFORM, so anything that would be displayed inside of -HTMLFORM won't work, including your JS functions.

One thing you might try that would give similar functionality would be to create this to output to EXL2K FORMULA.

However, I DO like the functionality / interactivity you are providing in the HTML form and have snipped your code to use as an example for future reference.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
I tried this and it worked without any problems in ReportCaster when the report is sent as an "attachment" and not an "inline message".



WF 5.3.2


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
Expert
posted Hide Post
You most likely will need to add the

SET FOCEXURL = 'webfocus-server-call' parameter in the fex.

e.g.
SET FOCEXURL = 'http://gfnotoeiprod/ibi_apps/WFServlet?'


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
Expert
posted Hide Post
So, Donald, have you given it a try? Setting the task to send the report as an "attachment" instead of an "inline message"?


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
Platinum Member
posted Hide Post
In my mind it is already an attachment Francis. What change would I have to make in order for it to be an attachment?


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
 
Posts: 116 | Registered: April 23, 2007Report This Post
<SomeUsr>
posted
quote:
when I run it manually it looks fine, but thru reportcaster I get a javascript error whenever a text box is updated.


What is the exact JavaScript Error you are seeing?
 
Report This Post
Expert
posted Hide Post
If you go to the Distribution tab, in the General Information box, there are 2 radio buttons. Make sure that the first one is selected.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
<SomeUsr>
posted
quote:
<SCRIPT>
function projectFuture(num)
{
for (i=1; i<4; i++)
{
 var costName='cost' + num + '_'+i;
 var rebateName='rebate' + num;
 var newCost=document.getElementById(costName).value * ((100 - document.getElementById(rebateName).value) / 100);
 var idName='infld' + num;
 var outName='outfld' + num;
}
document.getElementById(idName).firstChild.nodeValue=newCost;
document.getElementById(outName).value=newCost;
}
</SCRIPT>



I think your issue might due to different clients have slight different DOM setups and the first chlid might not be always the text node that you want to update with the new value. It seems to be most of the time, but I have observed where that is not true, so when the javascript codes goes to run the ".firstChild" code it actually gets a non-text node to update in the DOM causing the JS Error.

The following JS code should fix that issue... See if this removes your JS error.

<SCRIPT>
var TEXT_NODE=3;
function projectFuture(num)
{
  for (i=1; i<4; i++)
  {
   var costName='cost' + num + '_'+i;
   var rebateName='rebate' + num;
   var newCost=document.getElementById(costName).value * ((100 - document.getElementById(rebateName).value) / 100);
   var idName='infld' + num;
   var outName='outfld' + num;
  }
  tmpObj=document.getElementById(idName).childNodes;
  for (cntr=0;cntr<tmpObj.length;cntr++)
  {
    if (tmpObj[cntr].nodeType==TEXT_NODE) { tmpObj[cntr].nodeValue=newCost; }
  }
  document.getElementById(outName).value=newCost;
}
</SCRIPT>
 
 
Report 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     [SOLVED] javascript error thru reportcaster

Copyright © 1996-2020 Information Builders