Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Load & Trim OSUser variable

I'm trying to implement a "My Assigned Tasks" button whose action selects the currently logged on user (OSUser) from an already existing field (assigned_to). My problem is that the OSUser value needs 11 characters trimmed from the beginning, and this is proving to be difficult. I've put this in the script as a load statement, but get the obvious error that the OSUser field doesn't exist:

LOAD Right(OSUser, Len(Trim)-11) as UserName

;

Once I have the OSUser isolated to match the assigned_to field (which will match after the character trim) I might need some advice/suggestions on how to implement this via a button/bookmark combo or other method. Thanks.

1 Solution

Accepted Solutions
mphekin12
Valued Contributor

Re: Load & Trim OSUser variable

Add the 'Select in Field' action on the 'Actions' tab of the Button's properties.  Set the Field equal to 'Assigned_To' and the Search String equal to '=right(OSUser(),len(OSUser())-11)'

That should do the trick.

9 Replies

Re: Load & Trim OSUser variable

Hi

     Did you expected something like attached file?

mphekin12
Valued Contributor

Re: Load & Trim OSUser variable

Add the 'Select in Field' action on the 'Actions' tab of the Button's properties.  Set the Field equal to 'Assigned_To' and the Search String equal to '=right(OSUser(),len(OSUser())-11)'

That should do the trick.

Re: Load & Trim OSUser variable

If you are trying to pick off the user portion after the domain name:

domain\user

a more flexible expression is:

subfield(OsUser(),'\',-1)

-Rob

mphekin12
Valued Contributor

Re: Load & Trim OSUser variable

rob,

thanks for the tip.  can you tell me what the -1 parameter means?

Re: Load & Trim OSUser variable

-1 means first substring from the right.

-Rob

mphekin12
Valued Contributor

Re: Load & Trim OSUser variable

Thank you Rob!

Not applicable

Re: Load & Trim OSUser variable

That's exactly what I was looking for, mphekin12; but when I used the search statements you and Rob Wunderlich suggested, nothing happened when I clicked the button. Just to make sure, I did a control experiment with the following entries for the field & search strings:

=app_id

=73

=app_name

="UAR"

Still, nothing was selected after I pressed the button. I don't understand, since I made doubly sure there were no extraneous values selected on the sheet I was working on. Am I using the wrong syntax?

mphekin12
Valued Contributor

Re: Load & Trim OSUser variable

bikeking8,

can you post a sample application?

Not applicable

Re: Load & Trim OSUser variable

Just found out this approach wouldn't work given the field values in the database. Sorry to have wasted your time, but I'll close this up correctly.

Community Browser