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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure that requires CE User Name as a parameter 1

Status
Not open for further replies.

senglish

Programmer
Nov 4, 2002
19
AU
I have a Crystal Report that calculates staff hours with two parameters - Username and period so it brings back hours for a specific period.
I am quite happy for the user to select the appropriate period.
However, I do not want them to be able to enter another user as they could look at data that they should not.

It works perfectly if I put in 'senglish' as the username but what I want to do is use CE User Name (the logged in user) to drive the stored procedure and hence the report.

I realise that you may suggest to create some sort of temp table and then select 'where user = username' but it in itself would not be easy because we are doing a recursive loop with the stored procedure to get not only the people who directly report to the manager but the people who report to them and so one.

Can anyone tell me how I might use CE User Name as a parameter for a stored procedure please?

Thanks

Stephen
 
If you don't have any subreports in your report, then you could make the report a subreport, create a formula that pulls CE User Name and then link that formula to the parameter for the stored proc in the subreport to pass the value in.

If you do this, your main report has to return at least one record in order for the subreport to run. What I usually do is create a command that returns the current date/time. You would also create a date parameter and link that to the date parameter for the stored proc in the subreport to pass that value in.

-Dell

DecisionFirst Technologies - Six-time SAP BusinessObjects Solution Partner of the Year
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top