• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • Last Modified:

Crystal Reports database connection to .csv file dependent on logged on username

I am going to create a .csv file and put it into a user directory on network.  Any file in that directory is for that specific user.  The directory name will reflect their network logon name.

Question is - can I setup one crystal report which will detect the current logged on name and pull the .csv file from the directory that matches the current logged on user?
2 Solutions
No , you can't!

You can create a database with 1 table and put the records for all users in this table. Add also a field UserName and put the user connected to each record. When you create your report you can get the currently logged user, either using a viewer or UFL and include it in the Record Selection formula. The result will be the report will show different set of data for each user. Here is a sample video showing how to pass the user name to the report using a viewer:
The viewer is R-Tag (www.r-tag.com) and the free version will be able to handle this.
Here is also a link to a free UFL, which can be used to get the current user name : http://www.viksoe.dk/code/u2lwin32.htm
As I read this, you want to change the data source based on the user's name.

You can't do that in the report.  You will have to build an application to get the user's name and change the report data source to the correct CSV or use a third-party tool that can change the data source.

There is a good list of viewer and schedulers on Ken Hamady's website

Ken does an annual evaluation of the viewers and has his review linked to his page.


Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now