deepskansal Posted February 27, 2009 Share Posted February 27, 2009 Hi Everyone,I have a requirement to display the name of the user logged onto JasperServer on all the reports he/she access within repository.As per a sample report names 'Sales By Month Report' available in Repository on JasperServer Pro 3.1 the same could be achieved by creating a parameter with parameter class as: <com.jaspersoft.jasperserver.api.metadata.user.domain.User>.However I am not able to make it work.Could anyone please guide me how to achieve this?Thanks,Deepak Link to comment Share on other sites More sharing options...
Solution swood Posted February 27, 2009 Solution Share Posted February 27, 2009 Have a look at the JRXML for the Sales By Month report. In your report, create a parameter: <parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User"/> This will automatically be populated when you run the report in JasperServer. In the report, you can refer to this parameter, like: <textFieldExpression class="java.lang.String"><![CDATA[$P{LoggedInUser}.getFullName()]]></textFieldExpression> or <textFieldExpression class="java.lang.String"><![CDATA[$P{LoggedInUser}.getUsername()]]></textFieldExpression> ShermanJaspersoft Link to comment Share on other sites More sharing options...
deepskansal Posted February 27, 2009 Author Share Posted February 27, 2009 Thanks for the help Sherman.I was missing $P{LoggedInUser}.getFullName()]].Thanks Again. Link to comment Share on other sites More sharing options...
rajesh.sm Posted October 28, 2013 Share Posted October 28, 2013 Hi Swood, as per your suggestion, i have created the sample. please find below jrxml file. i am getting empty report only. i not getting loggedinUserName. please advice me <?xml version="1.0" encoding="UTF-8"?> $P{LoggedInUser}.getUsername() $P{Username} Test Test is there anything i am missing. still my report is empty. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now