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

How to retrieve dashboard URI from jasper report


ktalarico

Recommended Posts

I need a way to determine the resource path of a dashboard from within a jasper report.  I want to use that as a parameter to set the data source of the underlying reports conditionally.  Here is the use case:

We have multiple tenants in our Jasper server repository.  We have copies of a single dashboard living in each tenant organization.  The dashlets/reports that run inside the dashboard live in the shared "public" area.  This is so that we do not have to deploy each report to multiple organizations.  The data source of the reports is dynamic - we are using organization-level attribute to set the data source.  This works if the user running the dashboard belongs to an organization.  For our internal users, who live at the root level, this does not work because we can of course only set one attribute for the datasource at the root level.  So, if the datasource attribute is set to ABC_CORP on the root organization, and the internal user goes to run the dashboard in the XYZ_CORP organization, the dashboard will run with ABC_CORPs data.  So I need to be able to extract the organization name from the dashboard's URI and store that in a parameter so I can set the datasource accordingly in my jasper report jrxml using the "com.jaspersoft.jrs.data.source" property.  The only thing attached to the organization is the dashboard itself.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

FWIW, I know I can create a parameter with an expression that makes an API call to get information about a report unit.  For example, com.jaspersoft.jasperserver.api.engine.jasperreports.util.RepositoryUtil.getThreadRepositoryContext().getReportUnit().getName().  I have searched to no avail for an API call that gets information about a dashboard.

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