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

Using Jasperserver user login in report (ireport)


jpclerc

Recommended Posts

Hello,

Thank you for your help Matt :-)

I have open in ireport 3.7.6 "/reports/samples/SalesByMonth"

I have found the use of "LoggedInUser" (Parameter class : com.jaspersoft.jasperserver.api.metadata.user.domain.User)

But I have the error :

Java.land.ClassNotFoundException : com.jaspersoft.jasperserver.api.metadata.user.domain.User

I have fetch the use of ths parameter in the query but I guess that the syntax should be
select ...
from ..
where tab.col = '$P{LoggedInUser}.getFullName()'

So I do and I have ther error :
1. Parameter type not supported in query : LoggedInUser class com.jaspersoft.jasperserver.api.metadata.user.domain.User

Thank you for your help

 

 

 

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

Pour complèter ma demande ....

soory ... to add somthong for my topic

 

LoggedInUser.getFullName() is the fullname

but what is the "shotname", the login only

for exemple JP / Monsieur Jean-Paul

LoggedInUser.getFullName() = "Monsieur Jean-Paul"

How can I do to retrieve only "JP"

Link to comment
Share on other sites

 I think there is a good explanation of "loggedinuser properties" in the tutorial about cascading input controls. It seems to me that you can get not only the fullname but other properties like the user id. If you have the user id, you can get all other fields in the JIUser table in the metadatabase jasperserver

Link to comment
Share on other sites

Also, if you want to see all of the classes and methods, you can download the Public API Javadoc. This can be found from the "releases" menu item. Look for the most current: version 3.7.1.

File name is:  jasperserver-ce-3.7.0-public-api.zip

It hasn't changed between 3.7.0 and 3.7.1.

Link to comment
Share on other sites

  • 2 weeks later...

Gaby38
Wrote:

 In fact you cannot write : 

where tab.col = '$P{LoggedInUser}.getFullName()'

You have to define another  parameter $P{FullName} initialized through its default value to $P{LoggedInUser}.getFullName()' and use it in where clause

 

Merci beaucoup ....

Link to comment
Share on other sites

  • 2 years later...

Hi,

 i have created the same. please find below jrxml file. i am getting empty report only. i not getting loggedinUserName. please advice me

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report7" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c1202fd9-44f4-42c6-a3c2-45c21bc60347">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User" isForPrompting="false"/>
<parameter name="Username" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA[$P{LoggedInUser}.getUsername()]]></defaultValueExpression>
</parameter>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="76">
<textField>
<reportElement uuid="b128f89e-0122-47be-a02e-e76026359414" x="22" y="21" width="364" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{Username}]]></textFieldExpression>
</textField>
</band>
</title>
<columnHeader>
<band height="50">
<staticText>
<reportElement uuid="6749d95a-5d66-49af-840a-d3afb0347883" x="268" y="26" width="100" height="20"/>
<textElement/>
<text><![CDATA[Test]]></text>
</staticText>
</band>
</columnHeader>
<summary>
<band height="130" splitType="Stretch">
<staticText>
<reportElement uuid="4a30d70a-23b5-4fa1-a80f-c2add14714d2" x="240" y="42" width="100" height="20"/>
<textElement/>
<text><![CDATA[Test]]></text>
</staticText>
</band>
</summary>
</jasperReport>
is there anything i am missing. still my report is empty.

Link to comment
Share on other sites

  • 1 year later...

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