Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Specialist
Specialist

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.

View solution in original post

9 Replies
MayilVahanan

Hi

     Did you expected something like attached file?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
mphekin12
Specialist
Specialist

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.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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
Specialist
Specialist

rob,

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

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

-1 means first substring from the right.

-Rob

mphekin12
Specialist
Specialist

Thank you Rob!

Not applicable
Author

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
Specialist
Specialist

bikeking8,

can you post a sample application?

Not applicable
Author

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.