el6uap0 Posted August 29, 2010 Share Posted August 29, 2010 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 More sharing options...
el6uap0 Posted August 29, 2010 Author Share Posted August 29, 2010 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 More sharing options...
Guest Posted September 22, 2010 Share Posted September 22, 2010 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 More sharing options...
el6uap0 Posted September 29, 2010 Author Share Posted September 29, 2010 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 More sharing options...
javi_123 Posted September 30, 2010 Share Posted September 30, 2010 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. RegardsJavi Link to comment Share on other sites More sharing options...
Guest Posted September 30, 2010 Share Posted September 30, 2010 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 More sharing options...
revolutionizeit Posted November 1, 2011 Share Posted November 1, 2011 Hi Mark,Did you get anywhere with this? If not, did you come up with any alternative solution?I am trying to do the same thing but struggling to find a solution.Any inputs will be appreciated.Cheers, Link to comment Share on other sites More sharing options...
andde Posted December 2, 2011 Share Posted December 2, 2011 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 More sharing options...
andde Posted December 16, 2011 Share Posted December 16, 2011 Just to keep to this alive, bump. Hope someone finds an answer.. Link to comment Share on other sites More sharing options...
waalp Posted January 3, 2012 Share Posted January 3, 2012 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 More sharing options...
andde Posted January 3, 2012 Share Posted January 3, 2012 Can you share your queryexecuter? Sounds like a great workaround :) Link to comment Share on other sites More sharing options...
waalp Posted January 4, 2012 Share Posted January 4, 2012 I will try to post our code at the end of the week/begining of next week. Regards,Peter Link to comment Share on other sites More sharing options...
waalp Posted January 25, 2012 Share Posted January 25, 2012 I've been a bit busy, because of a deadline... i'll try to post the queryExecuter code at the end of the week Regards,Peter Link to comment Share on other sites More sharing options...
lwang2012 Posted January 30, 2012 Share Posted January 30, 2012 is 'LoggedInUserTenantId' build-in parameter in JasperServer? otherwise, if it is user-defined, how to make it take such info? Link to comment Share on other sites More sharing options...
andde Posted February 10, 2012 Share Posted February 10, 2012 It seems to be in-built even if it is not shown in ireport. It seemed to work in my tests anyway.. How about Peters examples? - Anders Link to comment Share on other sites More sharing options...
andde Posted October 23, 2013 Share Posted October 23, 2013 Hows this in latest versions? Any better solutions or still custom executers? Link to comment Share on other sites More sharing options...
iggi Posted February 6, 2015 Share Posted February 6, 2015 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now