etorona Posted January 30, 2013 Share Posted January 30, 2013 Hi,I want to get the logged username to use it in a report query My jxml have 2 parameters :-parameter class="com.jaspersoft.jasperserver.api.metadata.user.domain.User" isforprompting="false" name="LoggedInUser"> -parameter class="java.lang.String" isforprompting="false" name="Utilisateur"> defaultValueExpression ![CDATA[$P{LoggedInUser}.getUsername()]] My query use looks like : ... where u.nomsgbag = $P{Utilisateur} ... When i execute the report i always get Utilisateur as null values. if i display it in a text field i get the username. any HELP ! Thanks Link to comment Share on other sites More sharing options...
ernestoo Posted January 30, 2013 Share Posted January 30, 2013 The forum seems to have eaten the formatting - I cant see how you declared the parameters. I'll take a wild guess though - you declared LoggedInUsername BEFORE Utilisateur? If that's the case then the default value for Utilisateur wouldn't be populated before LoggedInUsername? Also, take a look at my sample here, maybe it helps? http://community.jaspersoft.com/wiki/designing-row-based-security-standard-reports Link to comment Share on other sites More sharing options...
etorona Posted January 31, 2013 Author Share Posted January 31, 2013 thanks for response. i have in fact LoggedInUser before Utilisateur parameter but i get always a null value. Link to comment Share on other sites More sharing options...
ernestoo Posted January 31, 2013 Share Posted January 31, 2013 Oh then I think you're making things more complicated for yourself, just need this: Link to comment Share on other sites More sharing options...
etorona Posted January 31, 2013 Author Share Posted January 31, 2013 IT Work! Thank you very very much !! Link to comment Share on other sites More sharing options...
amine.benyoussef Posted November 6, 2014 Share Posted November 6, 2014 Sorry I have the same Problem. In iReport a created a parameter : LoggedInUser Parameter Class: com.jaspersoft.jasperserver.api.metadata.user.domain.User With no DefaultValueExpression. I have a second Parameter : FullName Parameter Class : String Default Value Expression: $P{LoggedInUser}.getFullName() When I display it in the report it's always NULL. Please Help 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