Jump to content
We've recently updated our Privacy Statement, available here ×

[SOLVED]Problem with Username in report query


etorona

Recommended Posts

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

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

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

  • 1 year later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...