Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In our application, we have 6 expressions to aggregate data.
However, depending on user's security setting, most users should ONLY see 3 expressions loaded in list box. So I need a way to load Expression listbox dynamiclly.
I had following codes in my loading script, but it does not work:
secTmp:
select securityToken from $(DBOWNER).sysSecurity where logonid = QVUser()
let secToken = FieldValue(securityToken,1);
Exp:
load * inline [Exp
Sales
SaleQty
% of Total Sales
] ;
if ($(secToken)= 'Y') then
concatenate( Exp)
load * inline [Exp
COGS
Margin
Margin %
] ;
end if
Qlikview first complained QVUser is not a valid function, and then complained my if block has syntax error.
Anyone help me ??? Thanks!
Hi,
This solution won't work because, as you have identified, the QVUser() function is not relevant at load time. Even if it was, it would return the user who was performing the reload, not one of your end users.
What you should probably look at is linking the users to the data like this:
Section Access;
LOAD * INLINE [
ACCESS, USERID, TOKEN
ADMIN, ADMIN, *
USER, USER1, Y
USER, USER2, N
];
Section Application;
ListBox:
LOAD * INLINE [
TOKEN, ListboxValue
Y, A
N, A
Y, B
N, B
Y, C
];<div>
Hello Paul,
I see some syntax errors, that may be typos when writing this post, but it's worth looking at it in your original code:
select securityToken from $(DBOWNER).sysSecurity where logonid = 'QVUser()'; // quoted since it's a literal and semicolon to end the line let secToken = FieldValue('securityToken',1); // fieldnames in fieldvalue are always quoted
Now it should work.
I wish I had addressed my issue more clear in original post.
I have users list stored in a security table, and the user list is loaded in Section access.
Say, 2 users,
User Token
A Y
B N
Then I have a listbox called 'Expression' , which is using inline load in Section Application.
My requirement is: when a user's Token is 'Y', I want the listbox be loaded values A and B and C;
when a user's Token is 'N', I want the listbox be loaded values A and B only (without C).
Kind of dynamic loading of a listbox, depending on user's setting.
I am not sure if I can use function QVUser() in loading script since QVUser() is used to access who is opening my document on the server.
I checked Qlikview's data reduction and still don't get the idea.
Any idea? Thanks!
Hi,
This solution won't work because, as you have identified, the QVUser() function is not relevant at load time. Even if it was, it would return the user who was performing the reload, not one of your end users.
What you should probably look at is linking the users to the data like this:
Section Access;
LOAD * INLINE [
ACCESS, USERID, TOKEN
ADMIN, ADMIN, *
USER, USER1, Y
USER, USER2, N
];
Section Application;
ListBox:
LOAD * INLINE [
TOKEN, ListboxValue
Y, A
N, A
Y, B
N, B
Y, C
];<div>
Steve, thanks and your solution works!
The only addition to your solution is I need to load Y and N to the token.
LOAD * INLINE [TOKEN
Y,
N];