【发布时间】:2019-05-04 21:57:43
【问题描述】:
我在 Apex 5 中的所有图表中都使用 AnyChart。现在我升级到 18.2,AnyChart 现在是“旧版”。所以,我想更新我的图表以使用 JET Chart。
我的图表使用“PL/SQL 函数体返回 SQL 查询”。我的 PL/SQL 函数体动态构建我的查询,我显示的系列数量可能会有所不同。因为我不知道我会有多少系列,所以我无法在我的图表中设置我的系列。
这是我的 PL/SQL 函数体:
DECLARE
l_selected APEX_APPLICATION_GLOBAL.VC_ARR2;
l_sql VARCHAR2(4000) := '';
BEGIN
--
-- Convert the colon separated string of values into a PL/SQL array
l_sql := l_sql || 'SELECT NULL link ';
l_sql := l_sql || ' ,year_month label ';
l_selected := APEX_UTIL.STRING_TO_TABLE(:P16_SELECT_LIST);
--
-- Loop over array to insert department numbers and sysdate
IF l_selected.count = 0 THEN
l_sql := l_sql || ' ,NULL "no data" ';
ELSE
FOR i IN 1..l_selected.count LOOP
l_sql := l_sql || ',MIN(DECODE(sqn, '''||l_selected(i)||''', srt_cnt, NULL)) "'||l_selected(i)|| CASE WHEN REGEXP_LIKE(TRIM(l_selected(i)), '^[[:digit:]]') THEN ' Sqn' ELSE NULL END||'"';
END LOOP;
END IF;
l_sql := l_sql || ' FROM flight_and_mmh t ';
l_sql := l_sql || ' WHERE snapshot_fk = :P27_SNAPSHOT_LIST ';
l_sql := l_sql || ' AND INSTR('':'' || :P16_SELECT_LIST || '':'' , '':'' || sqn || '':'') > 0 ';
l_sql := l_sql || ' GROUP BY t.year_month ';
l_sql := l_sql || ' ORDER BY t.year_month ';
RETURN l_sql;
END;
【问题讨论】:
标签: oracle charts oracle-apex