Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/435.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用正则表达式将Adobe LiveCycle FormCalc摘要函数转换为JavaScript_Javascript_Regex_Notepad++_Livecycle Designer - Fatal编程技术网

使用正则表达式将Adobe LiveCycle FormCalc摘要函数转换为JavaScript

使用正则表达式将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

在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(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 例如,我们可以使用记事本++中的find/replace编写正则表达式来实现上述转换吗

(注意:对问题进行了修改,以简化所需的更改和正则表达式。)