Crystal Reports Parameter Issue

ogmike2000
ogmike2000 used Ask the Experts™
on
I'm using Crystal Reports in Visual Studio 2010.  My report works and displays as it should but I would like to limit a user to only be able to run a report on their specific "mailboxes".  I can set the datasource for the mailbox parameter to a field in the database but it allows any mailbox to be selected.  I can create a dataset that filters the table based on their login or profile.UserName which queries the correct data, but how to I pull data from that dataset into a dropdown box for the report parameter.  Is there a way to not use a dataset and define a filter in the parameter setup?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
WIll a user be able to see mail information they don't have permission to or do you just want to limit what the can query?

I believe you can have 2 queries in the report and use one of them when you create the parameter.

mlmcc

Author

Commented:
I would like to be able to limit the information they can actually see but I was planning on doing that by pulling data from a table adapter query based on their profile variable and attaching that data to the report.
I see in the parameter dialog where I can insert a query but I don't know the exact syntax to filter by Profile.Username because my report doesn't seem to recognize the profile parameters.  
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
I don't think you can do it through the parameter screen.  I think you will have to write the query in the database and add it to the report.  You may then be able to use a parameter on it.

Another way would be to write  small application to run the report and prompt for the parameters or in this case just read the current user.

mlmcc

Author

Commented:
I could get all of the parameters from the user on a web form and store those results in variables then pass to the report but would like to use the built in Crystal Reports prompt UI.  I will try the database query.

Author

Commented:
I've done some more research and have seen a "filter by user" option with Crystal Reports.  I don't know where to find it in VS2010 or the syntax to set in programatically.  I want to set it to Profile.UserName.  Anyone know more about this?
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
Where have you seen the FILTER BY USER?

SInce generally the version built for use with VS is a stripped down version of Crystal it may not be available in that version.  

mlmcc
Top Expert 2011
Commented:
You will need to create your own interface to insert parameter values and pass them to the report. Then you will be able to control what is available for selection. If you set the parameters' values programmatically crystal reports parameters dialog will be not shown.  

Author

Commented:
Thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial