Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

joeybird
Contributor II

OSUser not working on qlik sense / server version June 2017

Hi

I have been having trouble using the following code in Qlik , since the new June 2017 upgrade

has there been a amendment on how this code should be used or is there an error with the new server?

here is an example

Count({<UserID = {'$(=SubField(upper(OSUser(), '=', -1)))'}>}distinct([Order_Number]))

I have also for the

for UserID and OSUser I have made sure in the load it looks like the following in the load

Upper(UserID) as UserID

Upper(OSUser) as OSUser

any ideas please team?

1 Solution

Accepted Solutions
felipedl
Valued Contributor III

Re: OSUser not working on qlik sense / server version June 2017

Joanna,

Might be dumb, but its because of the single quotes your using on the set analysis.

Instead, use

Count( {<UserId={"$(=SubField(lower(UserId), '=', -1))"}>}  distinct [Order_Number])

As an e4xpression.

Theres a difference between the two now in this release.


Used the following code:

Sample.png

Which gives me the following

Sample.png

see this as reference: Quotes in Set Analysis

14 Replies
felipedl
Valued Contributor III

Re: OSUser not working on qlik sense / server version June 2017

Hi Joanna,

You're missing a parenthesis of the "upper(OSUser()" statement, you have:

Count({<UserID = {'$(=SubField(upper(OSUser(), '=', -1)))'}>}distinct([Order_Number]))


but should be


Count({<UserID = {'$(=SubField(upper(OSUser()), '=', -1)))'}>}distinct([Order_Number]))


Just testes it here with the expression =Subfield(upper(OSUser()),'\',-1) and works fine.


Felipe.

joeybird
Contributor II

Re: OSUser not working on qlik sense / server version June 2017

Hi

sorry this did not work

checking the server the username (for computer login is) is a mixture of letters and numbers e.g

aa123456789

I have checked the server and it reads in as lowercase too

so this is as

aa123456789

but in app I have used the upper command so it looks like AA123456789 in the load

so I also tried

Count({<UserID = {'$(=SubField(lower(OSUser()), '=', -1)))'}>}distinct([Order_Number]))

with no joy

any more ideas team please?


felipedl
Valued Contributor III

Re: OSUser not working on qlik sense / server version June 2017

Hi Joanna,

Just try out OSUser() and see the result it gives, i'm assuming the user name doesn have the '=' you're putting in the subfield statement.


Can you share the app?

joeybird
Contributor II

Re: OSUser not working on qlik sense / server version June 2017

Hi

I cant really share the app sorry

but using OSUSER() has outputted

UserDirectory = Domain; UserId=aa123456789

please help

felipedl
Valued Contributor III

Re: OSUser not working on qlik sense / server version June 2017

Hi Joanna,

It seems the evaluation on the set analysis is probably returning null or some value incompatible with what your trying to compare *UserID". It will need some debbuging to get it right.


Try the following, put the =SubField(lower(OSUser()), '=', -1) expression in a text box and see what it returns and see which values you have for UserID,.


My guess it's that you don't have the user you posted above in your bae, or $ expansion is returning null.


Felipe.

joeybird
Contributor II

Re: OSUser not working on qlik sense / server version June 2017

Hi

=SubField(lower(OSUser()), '=', -1) returns

aa123456789

I have replaced the set anaylsis with the above and I still get no answer

I tried to remove the $ and I get error in set analysis

please help

felipedl
Valued Contributor III

Re: OSUser not working on qlik sense / server version June 2017

Is there an association between the tables and for the table that has the UserID, does it have the entry (row) with the value UserID = aa123456789  (with the lowercase letters)?


Since I can't see the data, i'm doing guesses to see if it helps.

joeybird
Contributor II

Re: OSUser not working on qlik sense / server version June 2017

hi

yes, I have even now in the data load

done lower(OSUSER) as UserId

also changed the UserID to UserId to see if it help with the matching

UserDirectory = Domain; UserId=aa123456789

any more ideas.. how would you remove the $ expansion?

felipedl
Valued Contributor III

Re: OSUser not working on qlik sense / server version June 2017

What I meant was, do you have on the loaded table the value "aa123456789".


Check in the data model or create a simple filter and check if your base has the "aa123456789".

IF not, set analysis wont find the specified user id and can't use it for calculations.


This part you mentioned "UserDirectory = Domain; UserId=aa123456789" is the value from the AD, but somewhere you need to have this value in Qlik so that set analysis can search it.


Final thing is that you might not have a Order_Number associated to this user in your tables, check those too .