如何在顶点创建树形图 5.



在Oracle-Apex中创建树形图需要做什么?我已经尝试了一切,但我无法生成树形图。

我正在尝试使用 siguienet 查询生成图表:

select case when connect_by_isleaf = 1 then 0 
when level = 1 then 1 else -1 end as status,
        level,
        ename as title,
        'icon-tree-folder' as icon,
        empno as value,
        ename as tooltip,
        null as link
   from emp
  start with mgr is null
connect by prior empno = mgr
  order siblings by ename

你"不能创建树形图"是什么意思?为什么不呢?

最简单的方法是:

  • 使用向导创建页面
  • 选择形页面类型(否则,它要么不起作用,要么会使你的生活比它应该的更复杂(
  • 按照向导的说明进行操作
  • 选择表名称(例如斯科特的 EMP 表(
    • ID = 恩普诺
    • 家长 ID = MGR
    • 节点文本 = ENAME
    • 开头为 = MGR
    • 开始树 = 值为空
  • 接受其余建议的选项
  • 运行页面 - 树在这里

查询如下所示:

select case when connect_by_isleaf = 1 then 0
            when level = 1             then 1
            else                           -1
       end as status, 
       level, 
       "ENAME" as title, 
       null as icon, 
       "EMPNO" as value, 
       null as tooltip, 
       null as link 
from "#OWNER#"."EMP"
start with "MGR" is null
connect by prior "EMPNO" = "MGR"
order siblings by "ENAME"

基本上,与您的相同(我只是没有进行任何更改,因此列名括在双引号中,FROM子句包含#OWNER#(。

如果存储在表中的数据构成层次结构,它将起作用;没有理由不应该这样做。

最新更新