Jump to content
Changes to the Jaspersoft community edition download ×

Multiple organizations, same reports/queries


el6uap0

Recommended Posts

Good morning,

We have an installation of JasperServer where we deploy the same exact reports across multiple organizations.  All of the reports are identical - jrxml, parameters, input controls (query based), etc.  The only thing that is different from one organization to another is the data source.

We have placed the jrxml in a public directory and all of the organization report units reference it.  How do I deploy my input controls in a public fashion as well?  The problem that I am facing is that the input controls, when defined as single select queries, require a data source.  But since my data source varies from organization to organization I cannot define the data source at the input control.  I thought to reference a query resource, but the queries when created, also require a data source.

Any ideas?  Help would be greatly appreciated.  Right now we are redeploying and editing input controls in far too many places and it is a management nightmare.

Mark

Link to comment
Share on other sites

  • Replies 16
  • Created
  • Last Reply

Top Posters In This Topic

A little more research has led me to look into custom data sources. If anyone can give a bit more information on custom data sources here it would be really helpful. I am deploying my reports via iReport and publishing up to JasperServer.

 

- My datasources are defined in JasperServer: organization1/datasources/db1, organization2/datasources/db2

- I can introduce a parameter in my iReport: $P{datasource}

- I can create the input control in JasperServer

- I can also pass the value of the datasource to the parameter via the webservice once the report is run

 

So I guess my question is how do I get the datasource to "register" via the parameter? I think I understand the pieces, but I don't fully grasp the integration or implementation.

 

Any thoughts?

 

Mark

Link to comment
Share on other sites

  • 4 weeks later...

 Did you ever get to the bottom of this?    

My guess is that it isn't possible using the normal report unit installation process and using the default data sources.   I can imagine a way to do this using a custom data source that acts like a proxy to an organization's specific data source... however this is only a theory and may not work well in practice. 

I'd be interested in your solution if you came up with any, else I may be doing what you are doing and duplicate the common reports in each organization's tree. 

Thanks,

Rob

 

 

 

 

Link to comment
Share on other sites

 So far nothing ... We did move the jrxml to a public directory so at least the report jrxml is being referenced.  This helps so that we do not actually have multiple versions of the same report out there.  We do, however, still have to deploy the report units for each one of our organizations.  

It's quite a pain.

Mark

Link to comment
Share on other sites

I don't know whether it will help but here is what I would suggest and may be it will solve your problem.

Lets say you have a organization called 'Fred', name you datasource as 'Fred_datasource'.

Then in you report query you can do like this...

SELECT

....

FROM '$P!{LoggedInUserTenantId}'_datasource.tablename;

 

When you login as a user which belongs to a particular organization, it will pass the LoggedInUserTenantId and the data will be filtered based on the LoggedInUserTenantId.

 

This works as i have already tried it when jasperserver wasn't working on a multi tenant environment.

 

Regards

Javi

Link to comment
Share on other sites

Javi...

Thanks for your suggestion. It seems like that would be a good solution. However in my case it wouldn't work since each organization's database resides on a different database server.

Javi, Mark,

I am wondering if it would be possible to create a generic datasource service to solve the issue.  When I get time I have a few ideas I want to try out.  However time is not something I have a lot of these days. If I get any further on this, I will be sure to share what I come up with.

Thanks,

Rob

 

 

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...

Hi,

I am struggling with this also. Seems like exactly same scenario.

Placing jrxml on public is somewhat poor solution, because reports usually consist of  3 jrxml, 2-3 resource bundles and 2-3 input controls.. If i understood anything, you still have deploy report to organization level as a jasperreport.. so all that "bundled".. 
So i hope someone will come up with a solution.. :)

Cheers,
Anders

 

 



Post Edited by andde at 12/02/2011 12:11
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Hi guys,

 

We are also using the same reports for multiple clients in a multitenancy situation, for this we created our own query executer. Together with a table in the postgres database (we are using postgres for the data) wich maps a customer to a certain database server, we are able to use the same jrxml for multiple customers.

 

After login we match the tenant name with a record in the customers table, wich then is used to map it to the right database.

We use the datasource parameter of an ireport to direct to the postgres database so that is the initial connection a report has.

 

Hope this helps a bit.

Regards,

Peter

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
  • 1 year later...
  • 1 year later...

I have been under the same scenario and without a proper solution, I am making copies of the JRXML file into the respective organization's folder and then creating a data source pointing to the respective organization's database.

 

Do anyone know how to call the Tenant Name into the Report Title of my JRXML file instead of Tenant ID ($P{LoggedInUserTenantId})?

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