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.
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,
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?
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.
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, 2007
<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>