Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Sign up

Sign up | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Where Clause Query Parameters - Current User
August 31, 2010
9:27 am
Avatar
dkitzelman
Member
Members
Forum Posts: 4
Member Since:
August 7, 2013
sp_UserOfflineSmall Offline

I would like to pass in a parameter for current logged in user in a where clause for a work order search, so that the results in a result set only brings back records for the user currently logged in.  I tried "where reportedby = &USERNAME&" but the UI does not recognize this parameter.

 

Any ideas?

 

Thanks in advance,

Derek

August 31, 2010
11:36 am
Avatar
ecadillo
Lima, Perú
New Member
Members
Forum Posts: 1
Member Since:
August 7, 2013
sp_UserOfflineSmall Offline

Try with

where reportedby = :USER

 

Edwin

September 6, 2010
1:14 pm
Avatar
nofear
New Member
Members
Forum Posts: 1
Member Since:
August 7, 2013
sp_UserOfflineSmall Offline

&USERNAME& is only use in DB Configuration. Try with :user

March 20, 2015
1:42 pm
Avatar
Tom Kennedy
Member
Members
Forum Posts: 19
Member Since:
March 2, 2015
sp_UserOfflineSmall Offline

Indeed that works for the current logged in user.  However, if you save the query, that users id 

is stored the the saved query.  So it does not work for other users.

 

How can I save a query that does not have :USER instantiated?

March 24, 2015
5:45 pm
Avatar
Glen Holt
Member
Members
Forum Posts: 10
Member Since:
August 8, 2013
sp_UserOfflineSmall Offline

I may be misunderstanding, but here is what I do:  After saving when you go into 'View/Manage Queries' you should be able to change all of these to :USER, click Ok and it's all set up. Any user clicking on the query will only see results associated with their labor code.

March 24, 2015
10:54 pm
Avatar
Joe Lonjin
Member
Members
Forum Posts: 3
Member Since:
October 17, 2014
sp_UserOfflineSmall Offline

Yes I believe the issue described after trying :user is that you ran the query and then tried to save it. When you do this the system inputs the :user parameter from the logged in user and that is now displayed in the where clause. Glen is right, open the View/Manage Queries and open the clause, change the userid back to :USER and save.

Forum Timezone: America/New_York

Most Users Ever Online: 54

Currently Online:
1 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

madd0g17: 59

sun kim: 56

Maximofresher: 42

cgregory: 40

v.barsamov: 38

matta0990: 32

Member Stats:

Guest Posters: 0

Members: 13022

Moderators: 0

Admins: 2

Forum Stats:

Groups: 1

Forums: 8

Topics: 1433

Posts: 4010

Newest Members:

Kevin Linn, Ahmad Jaber, WENDY TEE, Gabriele Giovannelli, Kristen Sibilia, Joe Grassia

Administrators: Chon: 1065, Joe Grassia: 0