【问题标题】:Calculate Sum of Oracle Apex Tabular Form Cell计算 Oracle Apex 表格单元格的总和
【发布时间】:2013-01-05 07:56:47
【问题描述】:

在我的 oracle 顶点表格形式中有一个名为 Amount 的列。在输入数据并显示在表格下方的Display only 字段上时,我需要计算此列下所有字段的SUM

我认为这可以使用 JavaScript 来完成,并在 onchangeAmount 列中调用 JavaScript

但我不知道如何以我的 oracle 顶点表格形式计算 SUMof Amountcolumn。我怎么能这样做?

【问题讨论】:

    标签: oracle11g oracle-apex tabular-form


    【解决方案1】:

    将以下JavaScript 代码添加到页面HTML Header 属性中:

    <script type="text/javascript">
    function tot_cal()
    {
    var f5=new Array();
    var tol=0;
    f5=document.getElementsByName("f05"); /*f05 is Apex array which holds the data*/
    
     for(i=0;i<f5.length;i++){
      tol = (tol*1) + (f5[i].value.replace(/,/g, '') * 1);
     }
    /* alert(tol); */
    $s('P10_AMOUNT_VALUE', tol.formatMoney(2,',','.'));
    }
    Number.prototype.formatMoney = function(decPlaces, thouSeparator, decSeparator) {
        var n = this,
        decPlaces = isNaN(decPlaces = Math.abs(decPlaces)) ? 2 : decPlaces,
        decSeparator = decSeparator == undefined ? "." : decSeparator,
        thouSeparator = thouSeparator == undefined ? "," : thouSeparator,
        sign = n < 0 ? "-" : "",
        i = parseInt(n = Math.abs(+n || 0).toFixed(decPlaces)) + "",
        j = (j = i.length) > 3 ? j % 3 : 0;
        return sign + (j ? i.substr(0, j) + thouSeparator : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thouSeparator) + (decPlaces ? decSeparator + Math.abs(n - i).toFixed(decPlaces).slice(2) : "");
    };
    </script>
    

    Amount 列的表格形式元素/元素属性属性:

    onchange="tot_cal();"
    

    【讨论】:

      猜你喜欢
      • 2012-02-20
      • 2021-11-07
      • 2015-09-19
      • 1970-01-01
      • 1970-01-01
      • 2022-01-23
      • 2016-09-01
      • 1970-01-01
      • 2013-10-24
      相关资源
      最近更新 更多