Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I pass a username into a WHERE Clause 1

Status
Not open for further replies.

amoeba102

Programmer
Apr 2, 2002
58
US
in CR9 when a user has to log in to get their report - is it possible to pass that username into a SQL where clause to be used to limit the records that display? or am I just missing a much easier way to allow 30-50 users to view the same report, but just the pieces (records) they have rights to?
 
If you are running Crystal Enterprise, I believe this functionality is available via CE Extensions.

Another option is to use a 3rd party tool
(see listing at:
My DataLink Viewer can automatically set the value of a report parameter to the User_ID who's logged in to the PC.
You then create a record selection formula in the
report to restrict the data accordingly.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
This would depend upon your database, which you didn't share.

You can create a SQL Expression that contains the get_user() equivalent function for your database, and then reference it in the record selection formula to filter rows.

-k
 
S.V. is absolutely correct; if what you need is the "database user_ID" and not the "PC user_ID" his approach is the best option.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido, we are using CE ver 8.5 and SQL Server 2k. We want to use Active Directory user info to restrict the data. is it possible to accomplish this in ver 8.5? if so, will you please explain or point me to the document that describe how we can go about accomplish this. your help is greatly appreciated.
 
Can other experts in the forum please help me out with this obstacle. your help is much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top