Skip to Content
0
Jul 27 at 05:04 PM

SQL SCRIPT analytic privilege OR command not working?

189 Views

Hi guys,

I have this authorization table which the sql script analytic privilege (AP) is accessing.

This is my SQL SCRIPT in AP:

"COUNTRY" IN (SELECT "ZCOUNTRY" FROM "_SYS_BIC"."AUTH_TABLE" WHERE BNAME = SESSION_USER and ZPROJECT = 'BIG')

AND

"FISCYEAR" IN (SELECT "ZYEAR" FROM "_SYS_BIC"."AUTH_TABLE" WHERE BNAME = SESSION_USER and ZPROJECT = 'BIG')

So if I will use BWTESTUSR2, it is working as expected. Report will only show COUNTRY ES and IN for the YEAR 2017.

However, if I will use the QLIKVIEW user, it will NOT SHOW any data. NO RECORDS upon generation of report.

But if I change the code from AND command to OR, ALL DATA will be shown for both users: BWTESTUSR2 and QLIKVIEW.

"COUNTRY" IN (SELECT "ZCOUNTRY" FROM "_SYS_BIC"."AUTH_TABLE" WHERE BNAME = SESSION_USER and ZPROJECT = 'BIG')

OR

"FISCYEAR" IN (SELECT "ZYEAR" FROM "_SYS_BIC"."AUTH_TABLE" WHERE BNAME = SESSION_USER and ZPROJECT = 'BIG')

What do you think is the reason?

Or how to fix this?

I was expecting to see YEAR 2018 and 2019 for ALL COUNTRIES for QLIKVIEW user.

Any help?

Or how can I do this using a procedure?

Thank you.

Loed

Attachments

ddrtp.png (12.5 kB)