我有基于此查询的交互式网格:
select id_no,
TESTID,
UNITID ,
result,
MEAN,
SD,
ROUND(((result - mean) / sd),2) AS SDI ,
LOW_LIMIT,
HIGH_LIMIT,
PERF_ID,
VALIDATED
FROM HAJJ_QC_RESULTS
where sample_id = :P13_SAMPLE
AND hospital_no = :P13_HOSPITAL
AND approved_date = :P13_FROMDATE
然后我创建了具有动态操作的按钮 单击按钮时我需要计算 PERF_ID 列 这是java脚本代码和单击按钮时按钮的工作原理 它计算网格中的数据,这是使用动态操作执行的代码
var widget = apex.region('validate').widget();
var grid = widget.interactiveGrid('getViews','grid');
var model = grid.model;
var v_amount = 0;
model.forEach(function (r) {
v_amount = 0;
model.setValue(r,'VALIDATED',2)
if (model.getValue( r , "SDI") >= 0 && model.getValue( r , "SDI") <= 1 )
{
v_amount += 1
model.setValue(r,'PERF_ID',v_amount)
//$s("PERF_ID",v_amount)
}
else if
(model.getValue( r , "SDI") <= 0 && model.getValue( r , "SDI") >= -1 )
{
v_amount += 1
model.setValue(r,'PERF_ID',v_amount)
//$s("PERF_ID",v_amount)
}
else if
(model.getValue( r , "SDI") >= 1.01 && model.getValue( r , "SDI") <= 1.5 )
{
v_amount += 2
model.setValue(r,'PERF_ID',v_amount)
//$s("PERF_ID",v_amount)
}
else if
(model.getValue( r , "SDI") <= -1.01 && model.getValue( r , "SDI") >= -1.5 )
{
v_amount += 2
model.setValue(r,'PERF_ID',v_amount)
//$s("PERF_ID",v_amount)
}
else if
(model.getValue( r , "SDI") >= 1.6 && model.getValue( r , "SDI") <= 2 )
{
v_amount += 3
model.setValue(r,'PERF_ID',v_amount)
//$s("PERF_ID",v_amount)
}
else if
(model.getValue( r , "SDI") <= -1.6 && model.getValue( r , "SDI") >= -2 )
{
v_amount += 3
model.setValue(r,'PERF_ID',v_amount)
//$s("PERF_ID",v_amount)
}
else if
(model.getValue( r , "SDI") > 2 )
{
v_amount += 4
model.setValue(r,'PERF_ID',v_amount)
//$s("PERF_ID",v_amount)
}
else if
(model.getValue( r , "SDI") < -2 )
{
v_amount += 4
model.setValue(r,'PERF_ID',v_amount)
//$s("PERF_ID",v_amount)
}
v_amount = 0;
})
单击“保存”按钮时出现的问题是不保存 PERF_ID 列数据 我检查了DML过程我只有一个可编辑区域 不保存数据是什么原因?
注意:如果我在 PERF_ID 列中为每一行逐一键入数据并保存其保存,但是 当数据通过java脚本代码填充时它没有保存它?
用途:
model.setValue(r,'PERF_ID',v_amount.toString())
来自 https://docs.oracle.com/en/database/oracle/apex/23.2/aexjs/model.html :
‘该模型对字段值的限制很少。然而,通常当模型数据支持 APEX 项目或 HTML 表单控件时,这些值都将是字符串。’
服务器端,APEX 将转换为数字,同时考虑任何格式掩码。