Report is empty for $P{LoggedInUsername}
Posted on July 12, 2009 at 9:29pm
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 14, 2009 at 12:22am
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 14, 2009 at 1:45am
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
Joined: Aug 21 2008 - 1:15am
Last seen: 2 months 1 week ago
Posted on July 14, 2009 at 2:19am
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 14, 2009 at 2:41am
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
Joined: Aug 21 2008 - 1:15am
Last seen: 2 months 1 week ago
Posted on July 14, 2009 at 3:12am
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 14, 2009 at 3:24am
Here you go.....................
Joined: Aug 21 2008 - 1:15am
Last seen: 2 months 1 week ago
Posted on July 14, 2009 at 9:59pm
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 15, 2009 at 5:33am
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
Joined: Aug 21 2008 - 1:15am
Last seen: 2 months 1 week ago
Posted on July 19, 2009 at 10:37pm
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 20, 2009 at 5:29am
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
Joined: Aug 21 2008 - 1:15am
Last seen: 2 months 1 week ago
Posted on July 20, 2009 at 5:38am
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 21, 2009 at 1:02am
Rohini,
Did you managed to get it working?
Regards
javed
Joined: Aug 21 2008 - 1:15am
Last seen: 2 months 1 week ago
Posted on July 21, 2009 at 3:21am
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 21, 2009 at 5:20am
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
Joined: Aug 21 2008 - 1:15am
Last seen: 2 months 1 week ago
Posted on July 24, 2009 at 2:15am
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 24, 2009 at 2:35am
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
Joined: Aug 21 2008 - 1:15am
Last seen: 2 months 1 week ago
Posted on July 24, 2009 at 4:26am
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 24, 2009 at 5:32am
Send me you applicationContext.xml from CE. I will have a look.
Regards
Javed
Joined: Aug 21 2008 - 1:15am
Last seen: 2 months 1 week ago
Posted on July 24, 2009 at 5:51am
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 24, 2009 at 7:06am
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
Joined: Aug 21 2008 - 1:15am
Last seen: 2 months 1 week ago
Posted on July 24, 2009 at 9:25pm
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago
Posted on July 26, 2009 at 11:17am
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
Joined: Jun 21 2006 - 12:48pm
Last seen: 10 years 7 months ago
Posted on July 27, 2009 at 5:09am
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
Joined: Jul 4 2009 - 3:48am
Last seen: 13 years 11 months ago