使用正则表达式将Adobe LiveCycle FormCalc摘要函数转换为JavaScript
在Adobe LiveCycle Designer(xfa forms)中,FormCalc中的摘要功能如下所示:使用正则表达式将Adobe LiveCycle FormCalc摘要函数转换为JavaScript,javascript,regex,notepad++,livecycle-designer,Javascript,Regex,Notepad++,Livecycle Designer,在Adobe LiveCycle Designer(xfa forms)中,FormCalc中的摘要功能如下所示: Sum(Row[*].parts_value) formCalcSum(this, "Row[*].partial_value"); function formCalcSum(prmNode, prmListStr) { var theList; var theSum=0; theList = prmNode.resolveNodes(prmListSt
Sum(Row[*].parts_value)
formCalcSum(this, "Row[*].partial_value");
function formCalcSum(prmNode, prmListStr) {
var theList;
var theSum=0;
theList = prmNode.resolveNodes(prmListStr);
if (theList) {
for (var i=0; i < theList.length; i++) {
theSum += theList.item(i).rawValue;
}
}
return (theSum);
}
以上内容必须转换为JavaScript,并且必须如下所示:
Sum(Row[*].parts_value)
formCalcSum(this, "Row[*].partial_value");
function formCalcSum(prmNode, prmListStr) {
var theList;
var theSum=0;
theList = prmNode.resolveNodes(prmListStr);
if (theList) {
for (var i=0; i < theList.length; i++) {
theSum += theList.item(i).rawValue;
}
}
return (theSum);
}
其中formCalcSum是新的JavaScript函数,定义如下:
Sum(Row[*].parts_value)
formCalcSum(this, "Row[*].partial_value");
function formCalcSum(prmNode, prmListStr) {
var theList;
var theSum=0;
theList = prmNode.resolveNodes(prmListStr);
if (theList) {
for (var i=0; i < theList.length; i++) {
theSum += theList.item(i).rawValue;
}
}
return (theSum);
}
函数formCalcSum(prmNode,prmListStr){
变量列表;
var theSum=0;
theList=prmNode.resolveNodes(prmListStr);
如果(列表){
对于(变量i=0;i