名称默认为此处(1); ask_steps = function({}, {Default Local}, nw = New Window("填写事件步骤时间", << Type("模态对话框"), << 返回结果, H 列表框( 面板框("填写步骤", 阵容框(N Col(2), 文本框("最短时间"), neb_min = 数字编辑框(.), 文本框("最大时间"), neb_max = 数字编辑框(.), 文本框("步骤时间"), neb_step = 数字编辑框(.), 文本框("插入最后一个"), cb_interpolate = 复选框({""}, << 设置全部(1)) ) ), 间隔框(Size(20, 0)), 面板框("操作", 按钮框("确定"), 按钮框("取消") ) ) , << 设置窗口图标("生存") ); 如果(nw["按钮"] != 1, Throw("已取消"); ); min_t = nw["neb_min"]; max_t = nw["neb_max"]; step_t = nw["neb_step"]; 如果(任何(缺少(min_t)、缺少(max_t)、缺少(step_t)),Throw("未填写步骤"); ); interpolate_last = N 项(nw["cb_interpolate"]); return(Eval List({min_t, max_t, step_t, interpolate_last})); ); add_risk_table = function({platform_ref, min_t, max_t, step_t, interpolate_last}, {Default Local}, rep = Report(platform_ref); dt = platform_ref << 获取数据表; ycol = ((rep << XPath("//TextBox[text()='事件时间: ']"))[1] << sib) << 获取文本; grouping_col = ((rep << XPath("//TextBox[text()='按 ']分组"))[1] << sib) << 获取文本; Summarize(dt, groups = by(Eval(grouping_col))); steps = min_t::max_t::step_t; vals = steps; For Each({group}, groups, m_tb = rep[OutlineBox(group), Table Box(1)] << 获取矩阵; times = m_tb[0, 1]; atrisk = m_tb[0, N Cols(m_tb)]; cur_steps = Step(steps, times, atrisk); // 最后一个不予接受 If(interpolate_last, If(times[N Rows(times), 1] < max_t & Is Missing(cur_steps[N Cols(cur_steps)]), cur_steps[N Cols(cur_steps)] = atrisk[N Rows(times), 1]; ); ); vals = vals |/ cur_steps; ); pb = Panel Box("风险表", tb_results = Table Box( String Col Box(Eval Insert("无风险 (^ycol^)"), groups), )); For(i = 1, i <= N Cols(vals), i++, cur_vals = vals[0, i]; title = Char(Remove From(cur_vals, 1)[1]); tb_results << Append(Number Col Box(title, cur_vals)); ); rep[List Box(2)] << Append(pb); rep[List Box(2)] << Append(Spacer Box(Size(0, 10))); ); cur_rep = Current Report(); 如果(Is Empty(cur_rep), Throw("没有打开的报告"); ); ob_refs = cur_rep << XPath("//OutlineBox[
@helpKey='Surv']"); 如果(N Items(ob_refs) == 0, Throw("未找到 Surv 平台"); ); Try( {min_t, max_t, step_t, interpolate_last} = ask_steps(); For Each({ob_ref}, ob_refs, platform_ref = ob_ref << 获取可编写脚本对象;add_risk_table(platform_ref, min_t, max_t, step_t, interpolate_last); ); , Throw("其他问题:" || char(exception_msg)); ); Write();