In your section access part, in the table where there is the ACCESS field, create a new column FLAG_ADMIN which is created automatically from the ACCESS column :
if(ACCESS='ADMIN', 1 , 0) as FLAG_ADMIN
in the section Application add this little table (no need to link it to any other table) :
LOAD * INLINE [
do not forget to activate to data reduction : check the check box (settings/document properties / tab : Opening / initial data reductionbased on section access)
Then in your document, use FLAG_ADMIN to test if your user is an admin ( or use max(FLAG_ADMIN) if some users are both ADMIN and USER).
P.S : I've made an enhancement request for having a native function to test if actual user is ADMIN or not. QlikTech have taken it into account (ID 754) but I don't know when they will add it.
Hope it helps
Sorry Bertrand for late reply.
I am still trying to resolve it.
I have to compare USERID of OSUSER() with the USERID available in the SQL SERVER table for Conditional SHOW.
Please tell me, Is there any FUNCTION in QlikView to compare one field-values(Column) with one hardcoded value.
FIELDINDEX and EXISTS can be used to compare this but it works only on the local machine NOT on the Server.
So,Please let me know the function of Comparison which works for the Server based Apllication.
Thanks and Regards
Hi, Ajay, I received your inquiry through internal server support. They should be getting back to you shortly with this possibility, but I wanted to post it here too for the public. Please try the wildmatch function for something like this in your conditional show function:
=sum(if(wildmatch(<user id field>,Upper(ltrim(rtrim(subfield(osuser(),'\',2))))),1,0))
This seemed to work on the server (v. 8.2) as well as through Developer. Good luck!
How about this (I haven't tried on server, but I believe it will work).
Define a variable "vAdmin" with value:
=concat(chr(39) & ca_user & chr(39),',')
Note the "=" is part of the variable value.
Define another variable "IsAdmin" with the value:
For your sheet conditional expression, use:
You could use the "=mixmatch(subfield(OsUser(),'\',2), $(vAdmin))" expression in your show condition, but making another variable makes it bit easier to on multiple sheets.
Let me know if it works. An example is attached. Add your userid into the script to test and reload, then you should see the "Admin only sheet".
SheetUser.qvw 117.0 K
Thank you very much Bertrand for your help.
I am sure your recommended solution will work.............. but my client asked to avoid Section-access.
So i have tried to use any function for comparison instead of Fieldindex/Exist..............Now Wilmatch/Mixmatch as shown in below post, is working fine.
Thanks once again!