Solved

Restrict data to that owned by current user

Posted on 2004-09-14
13
485 Views
Last Modified: 2008-01-09
I'm designing a report to be used with Counterpoint SQL, which uses a Crystal viewer.  It is a commission report, so while there are 30 reps and I have added a parameter to allow the user to select which rep they want to report on, there is nothing stopping a rep from choosing a different rep in the parameter field and seeing their commissions.  I am looking for a way to restrict the data returned by the report to that which is owned by the current user.  Ideally, I would be able to create a formula or parameter called UserID that would be populated by the current user id.  Then, I would be able to add a report restriction like DataRecord.Owner = UserID.  But I don't know how to capture the current user.  Any ideas?
0
Comment
Question by:sanw2020
  • 3
  • 3
  • 2
  • +2
13 Comments
 
LVL 22

Expert Comment

by:Ido Millet
ID: 12056144
Are you the developer of the viewer?  If so, just grab the user id from Windows and assign it to a parameter.

In my DataLink Viewer, I do this automatically if the report has a parameter called "DLV_User_ID."  That way the user never gets prompted for that parameter because the value is already set programmatically.

Cheers,
- Ido
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 12056182
Agree with Ido.

Are the reports being run from an application?

mlmcc
0
 
LVL 10

Expert Comment

by:ebolek
ID: 12056211
there is a formula in the special fields tbal in the field explorer

Current userid

You can use that in your select expert and check if the current userid(coming from report) = userid(coming from db) then you show the fields
Regards
Emre
0
 
LVL 22

Expert Comment

by:Ido Millet
ID: 12056325
Emre,

Can you clarify;  where exactly do you see that special field?

Is it possible you are looking at a formula provided by a User Function Library (UFL)
rather than by Crystal.  

By the way, a UFL is another option to provide the Windows user id to record selection
criteria within Crystal.  I'm aware of at least one 3rd-party UFL that provides a function for
returning the Windows User ID.

Cheers,
- Ido
0
 

Author Comment

by:sanw2020
ID: 12056380
Sorry, I "Accepted" the response from ebolek any my own response went away.  

No, I am not the developer of the viewer.
Yes, it's being run from within Synchronics Counterpoint SQL.  I can also be run outside of it using the Viewer.

I don't see the Special Field called Current User ID.

Sandy
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 28

Expert Comment

by:bdreed35
ID: 12056388
I was just about to post the same question as Ido.

I was looking and I only see Current CE User ID or Current CE User Name in CR 10.  I checked and both of those were not available in CR 9.
0
 

Author Comment

by:sanw2020
ID: 12056477
Ido, can you tell me how to get more information on the 3rd party UFL you are aware of that will return the Windows User ID?  

Sandy
0
 
LVL 22

Expert Comment

by:Ido Millet
ID: 12056497
Sandy,

If you are not the developer of the Viewer and if you need a solution that works with the existing viewer, the simplest solution is to create or purchase a UFL that has a function returning the Windows user_id.  

See list of UFLs under "Other Utilities" at: http://www.kenhamady.com/bookmarks.html
At least two of the UFLs listed there provide a User_ID function.

Cheers,
- Ido
0
 
LVL 10

Accepted Solution

by:
ebolek earned 250 total points
ID: 12056742
I was talikng about Current CE User ID and  Current CE User Name functions. She can use that in the select expert to get what she wants. However I am using 10 so I dont know she has those functions in the special fields tab.

Regards
Emre
0
 
LVL 10

Expert Comment

by:ebolek
ID: 12248139
Solution offered below should work
Comment from ebolek
Date: 09/14/2004 09:55AM PDT

Regards
Emre
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Execute a crystal report from vb2010 3 39
Crystal Reports Formula Field 17 64
cross tab report accumulative amount 9 45
Crystal Reports Groups need Hand Cursor on Hover 4 66
Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now