Jump to content
Changes to the Jaspersoft community edition download ×

Report is empty for $P{LoggedInUsername}


deepthirohini86

Recommended Posts

Hi,

 

If i am using the following entries in jrxml and upload it in to the jasper server,

while running the report it is telling that

"The reports is empty". The jasper server version is 3.5.0.

<parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User"/><parameter name="LoggedInUsername" isForPrompting="false">  <defaultValueExpression>$P{LoggedInUser}.getUsername()</defaultValueExpression></parameter><queryString><![CDATA[select * from user_details where first_name=$P{LoggedInUsername}]]></queryString>Kindly help me how to solve.

My Query is:

select * from user_details where first_name=$P{LoggedInUsername}If i am using the $P{LoggedInUsername } in the textFieldExpression it is fetching and showing me the logged in user name.But if i am using in the parameter it is not fetching, it is telling the report is empty.With Regards,Rohini A.M



Post Edited by rohinijasper at 07/13/2009 05:10

Link to comment
Share on other sites

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

     I thinks that this is problem with the defaultValueExpression, Because if i remove the parameter passing it is working fine, that the user name is displayed in the textFieldExpression.

I also attached th JRXML file , kindly Jasper Admin can help me in this.

 

With Regards,

Rohini A.M

Link to comment
Share on other sites

Rohini,

Forgot to mention that you need to put the parameter in quotes:

SELECT

id, username, tenantId, fullname

FROM

`jasperserver`.`JIUser` JIUser

WHERE

username = '$P!{LoggedInUsername}'

 

I have tested it and it does work for me.

 

Regards

Javed

Link to comment
Share on other sites

Hello Javed,
         I go through ur jrxml file , whatever i am giving is right compare to your jrxml,
But i am having doubt in the following line,
SELECT
    id, username, tenantId, fullname
FROM
     `jasperserver`.`JIUser` JIUser
WHERE
     username = '$P!{LoggedInUsername}'

Why u are using back tick for `jasperserver`.`JIUser` JIUser

And also in our jasperserver we are having table jiuser not JIUser.

I think that this things i missed out.

 

I just give the query like the following,

 

select id,username,tenantId,fullname from jiuser where username='$P!{LoggedInUsername}'

 

I am getting the same that 'The Report is empty'.

 

What is the version of your jasperserver?

What is your database ? postgres or mysql

 

Thanks in advance.

Regards,

Rohini A.M

 

 

 



Post Edited by rohinijasper at 07/15/2009 05:12
Link to comment
Share on other sites

Rohini,

I am using iReports V3.5.2 and JasperServer V3.5 on SUSE Linux Enterprise Server Version 10, Service pack 2 with Mysql 5

 

The sql gets generated through the query designer in iReports and i have used it as a example.

 

I think you are using different version of JasperServer.

 

Do you still see the empty report or you have managed to get it working

 

Regards

Javed

Link to comment
Share on other sites

Hi Javed,

I am using iReports v 3.5.0 and Jasperserver v3.5,

i found in the jasper server log that

 

1. Parameter type not supported in query : LoggedInUser class com.jaspersoft.jasperserver.api.metadata.user.domain.User

 

Then in the lib directory of jar i extract the

jasperserver-api-metadata-impl-3.5.0.jar

 

But i am not getting the class

com.jaspersoft.jasperserver.api.metadata.user.domain.User

 

i am getting

com.jaspersoft.jasperserver.api.metadata.user.domain.impl.etc

 

so i am not found the class User.

 

Are you having any jar contains User class,

because i also using the same version 3.5 ,....

 

With Regards,

Rohini

 

Link to comment
Share on other sites

Rohini,

Are you using the community or professional edition??

Have you mande any changes in any of the .jar files??

 

I think it will be better if you do a fresh installation and see if the problem still occurs.

LoggedInUser does prompt with the error in iReports (java.lang.ClassNotFoundException) but not in jasperserver.

 

Regards

Javed

 

 

Link to comment
Share on other sites

Hi Javed,

 

I am still trying,

Actually i did the fresh extraction of war file , i am getting the reports empty message only ,still i am trying..........

I dont know where the actual problem is ...

 

Whether u are using commercial edition for jasper server or community edition.

 

 

Regards

rohini

Link to comment
Share on other sites

I am using the professional edition and have only worked on this edition but i think that should not make any difference. I don't understand why your are getting empty report.

 

One more thing, check the report properties in the report inspector section of iReports, look for a property 'When no Data Type' and see what is it set to.

 

Regards

Javed

 

 

Link to comment
Share on other sites

Rohini,

I really don't understand why you are not getting the values. I think it is something to do with community edition.

I suggest you to enable mysql debugging and check whether the parameter is passing any value or not.

Regards

Javed

Link to comment
Share on other sites

Hi javed,

I checked that it is passing the username as 'null' in postgresql log.

It is not passing the value, it is passing null,.

 

See this is my query log

SELECT

id, username, tenantId, fullname

FROM

jiuser

WHERE

username = 'null'

 

Whether i need to do any changes in the file like applicationContext.xml

With Regards,

Rohini

 

Link to comment
Share on other sites

Hi Javed,

           Ok i attached the .xml file , with this. I think that the community edition is not supported for the parameter, what is your view on that.

 

I am having another one question,

whether u are using the jasper server repository in the ireport.

Or u are integrating the jasper server with your application .

 

With Regards,

Rohini A.M

 

 

Link to comment
Share on other sites

Rohini,

I can't see any difference in the applicationContext.xml file. May be LoggedInUser is not supported in community edition but i am not sure about it.

 

I am using jasperserver repository in iReports.

 

I think its better to log a call to jasperserver through their support portal. I am sure they will respond quickly there becuase they charge for that......

 

Regards

Javed

Link to comment
Share on other sites

Hi Javed,

 Very much thanks for your response,

I am having one doubt that in jasperserver side ,

For getting the LoggedInUsername we need to add a parameter in the jasperserver web application or only

jrxml file is ok.

 

I am having my environment like this,

 

I download the jasperserver bin directory and extract that war into the tomcat webapps directory,

Then i use the ireport as a separate and create the jrxml file and upload that into the jasperserver web application.

 

 

Whether i need to explicitly add the LoggedInuser as parameter in jasperserver, if it is then how to add this.

Can you tell me how you add the repository in the ireport nb. Kindly tell me.

 

With Regards,

Rohini A.M

 

 

Link to comment
Share on other sites

Yes, you have to add the LoggedInUser parameter into your JRXML. The SalesByMonth example report that comes with the installer shows this.

 

There is documentation on using the iReport plugin in the JasperServer user guide.

 

Sherman

Jaspersoft

Link to comment
Share on other sites

Hi Swood Sir,

 

Actually in this forum i upload my problematic jrxml file, whatever steps you given

 

for getting the LoggedIn user name, i followed . But my problem is if i am using parameter in

 

the inject query my report is showing "The report is empty" . But if i use the

 

loggedInUsername in my report without passing the parameter it is showing the LoggedInusername

 

in report, My question is why the LoggedInUsername is not worked in parameter passing.

 

Upto date i am not get any solutions,.

 

I am using community edition.

 

Kindly suggest me.

 

Regards,

Rohini A.M

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...