Solved

Restrict data to that owned by current user

Posted on 2004-09-14
13
489 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

815 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

8 Experts available now in Live!

Get 1:1 Help Now