Using Jasperserver user login in report 01/10/2010 00:41
I've read all the entries related to how to use a user login in a report, but I'm missing something.
I've got 3.7 verson of jasperserver and the 3.6 version of iReports.
Most of the posts related to this say that you need to create 2 parameters. In iReports I've created a parameter LoggedInUser and set the Parameter Class to com.jaspersoft.jasperserver.api.metadata.user.domain.User and with a default value expression = Test
Then I create a second parameter UserID and give it a default value expression of $P{LoggedInUser}.getFullName()
The report has only one element - a text field to show the value of UserID. When compiled I get the error - ClassNotFoundException: com.jaspersoft.jasperserver.api.metadata.user.domain.User
RE:Using Jasperserver user login in report 01/10/2010 17:24
Thanks for the reply. I was thinking that if I copy the correct jar to the iReports lib folder, then set LoggedInUser with a default, it should work. Problem is I'm not sure of which jar and where to put it - iReports or Java folder
RE:Using Jasperserver user login in report 01/11/2010 16:10
How exactly are you useing "LoggedInUsername" and what do you mean by eliminates one parameter?
I've tried using it by itself setup as you describe and it come up null. I've gotten it to work where LoggedInUsername references a second parameter containing LoggedInUser.getUserName(), but at this time I can't get the parameter to work in a query.
RE:Using Jasperserver user login in report 01/11/2010 16:29
I have only tried this with JasperServer 3.5.0, but the only thing you have to do, is in iReport to add a parameter of type String which is called "LoggedInUsername" (and that's the name reserved by JasperReport). This should correspond to manually adding the jrxml as listed in my last reply.
Come to think about it, the LoggedInUsername gives you the login name of the user currently logged in to the JasperServer, and not the attached Full Name field of this Jasper user account.
However, if the username (not the full name) would suffice, for me having the LoggedInUsername as String parameter replaced the need for having both the "LoggedInUser" parameter and the second parameter with default value $P{LoggedInUser}.getUsername().
I think perhaps "LoggedInUserFullName" exists as well. Also a String parameter that Jasper provides automatically without any input control.
RE:Using Jasperserver user login in report 01/11/2010 22:15
I just loaded up a 3.5 Jasperserver and tested this. I logged in as userid = DMKTest. It's giving me the current default for LoggedInUsername "DMK" not the userid. Any idea why?
"I am running JasperReports and they are fantastic! I love iReport. I think it's a great very professional job. JasperReports and iReport are very cool. Nice work."