Report is empty for $P{LoggedInUsername}

0

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
rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago

23 Answers:

0

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

rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
0

Rohini, you just need to use exclamation mark in parameter used in the sql: select * from user_details where first_name=$P!{LoggedInUsername} Regards Javed



Post Edited by javi_123 at 07/14/2009 08:45
javi_123's picture
Joined: Aug 21 2008 - 1:15am
Last seen: 3 weeks 6 hours ago
0

Hello Javed,

Thanks for you reply.

             I changed the query to $P!{LoggedInUsername}, now also i am getting that the report is empty,

I am using the jasper server v3.5 version.

 

regards,

Rohini A.M

 

rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
0
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
javi_123's picture
Joined: Aug 21 2008 - 1:15am
Last seen: 3 weeks 6 hours ago
0

Hello Javed,

           I changed the query with single quotes also , but i am getting only report empty,

can you send me your .jrxml file i will tested it with my jasperserver. Kindly help me.

With Regards,

Rohini A.M

 

 

 

rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
-1

Here you go.....................

javi_123's picture
Joined: Aug 21 2008 - 1:15am
Last seen: 3 weeks 6 hours ago
0

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
rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
0
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
javi_123's picture
Joined: Aug 21 2008 - 1:15am
Last seen: 3 weeks 6 hours ago
0
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
rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
0
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
javi_123's picture
Joined: Aug 21 2008 - 1:15am
Last seen: 3 weeks 6 hours ago
0
Hi Javed, I am using community edition, i didn\'t made any changes in the .jar files. Ok i will do the fresh installation, Actually the errors i took from the jasper server log files. jasperserver/WEB-INF/logs/jasperserver.log
rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
0
Rohini, Did you managed to get it working? Regards javed
javi_123's picture
Joined: Aug 21 2008 - 1:15am
Last seen: 3 weeks 6 hours ago
0
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
rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
0
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
javi_123's picture
Joined: Aug 21 2008 - 1:15am
Last seen: 3 weeks 6 hours ago
0
Hi Javed, I checked with teh when no Data Type , i set it to "All Sections No Details", AFter that it is giving only the username, but not the query output. So i placed all the fields in the title itself there it is showing as null. Regards, Rohini A.M
rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
0

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

javi_123's picture
Joined: Aug 21 2008 - 1:15am
Last seen: 3 weeks 6 hours ago
0
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
rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
0
Send me you applicationContext.xml from CE. I will have a look. Regards Javed
javi_123's picture
Joined: Aug 21 2008 - 1:15am
Last seen: 3 weeks 6 hours ago
0

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

 

 

rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
0
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
javi_123's picture
Joined: Aug 21 2008 - 1:15am
Last seen: 3 weeks 6 hours ago
0

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

 

 

rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
0

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

swood's picture
2049
Joined: Jun 21 2006 - 12:48pm
Last seen: 2 years 2 weeks ago
0
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
rohinijasper's picture
Joined: Jul 4 2009 - 3:48am
Last seen: 5 years 4 months ago
Feedback