Solved

Restrict data to that owned by current user

Posted on 2004-09-14
13
484 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
Comment Utility
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
Comment Utility
Agree with Ido.

Are the reports being run from an application?

mlmcc
0
 
LVL 10

Expert Comment

by:ebolek
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 28

Expert Comment

by:bdreed35
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Solution offered below should work
Comment from ebolek
Date: 09/14/2004 09:55AM PDT

Regards
Emre
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 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

12 Experts available now in Live!

Get 1:1 Help Now