【问题标题】:Filter data in Interactive Report based on user根据用户过滤交互式报表中的数据
【发布时间】:2018-08-28 16:53:11
【问题描述】:
 select 
 case
 when :app_user = "John.Doe" THEN select * from time_test 
 when :app_user !="John.Doe" then select * from time_test where :app_user 
 =:app_user 
 end 
 from time_test ;

此表格本身是一个页面上的交互式报告。我希望每个人都能看到交互式报告,但我只希望 John Doe 看到整个表格。其他人只能在表格中看到他们的记录。

":app_user" 是 Oracle Apex 的默认绑定变量。我还尝试过滤表中的字段。

 select 
 case
 when :app_user = "John.Doe" THEN select * from time_test 
 when :app_user !="John.Doe" then select * from time_test where **name** 
 =:app_user 
 end 
 from time_test ;

还有

 select 
 case
 when name = "John.Doe" THEN select * from time_test 
 when name !="John.Doe" then select * from time_test where :app_user 
 =:app_user 
 end 
 from time_test ;

我不能使用 if 语句,因为它需要以 Select 开头才能加载到页面上。

【问题讨论】:

    标签: oracle oracle-apex


    【解决方案1】:

    简单过滤:

    select * 
    from time_test 
    where col_name =:app_user OR :app_user = 'John.Doe';
    

    【讨论】:

      【解决方案2】:

      Lukasz 的回答会很好。

      如果您想要更多的授权方案,您可以根据该条件设置一个

      :app_user = 'John.Doe'
      

      然后您可以将其用作任何组件的条件。

      如果您想将其用于行过滤,您可以在页面 P1_ROW_SEC 上设置一个隐藏字段,并添加计算以将其设置为 Y,但使用授权方案保护该计算。

      然后可以添加过滤器如

      and :P1_ROW_SEC = 'Y'
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-09-30
        • 1970-01-01
        • 2017-05-08
        • 1970-01-01
        • 1970-01-01
        • 2021-12-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多