// demodemo子表某字段求和公式
export default {
    execute:function(){
        if(arguments&&arguments[0]&&arguments[0][0]&&arguments[1]){
            let count = 0,_key = arguments[0][0].FieldCode,table = arguments[0][0].FieldTableCode,context = arguments[1];
            if(context.getTableType){
                let _tn = context.getTableType(table);
                let _data = context.getSubData(_tn.title);
                if(_data instanceof Array){
                    for (const iterator of _data) {
                        let _v = iterator.getValue(_key)
                        if(!isNaN(Number(_v + ''))){
                            count = accAdd(count,_v)
                        }else {
                            count = accAdd(count,0)
                        }
                    }
                }
                return count;
            }else{
                return context.colSum(_key);
            }
            
        }else{
            return '';
        }
    },
    getResultType:function(){
        return FMR.ConstDataTypes.General;
    }
}