#1 2016-09-19 12:19:39

TZM
Member
Registered: 2016-08-23

Unable to link imported rpts to existing d-sources other than default

Hi,

I have two main datasources set up...ProdDB and RSDB. In the Jasper report that I use...ProdDB is the DB to pull my main report data from..

BUT I also use RSDB ..which is the db reportserver uses to function..ReportServer Data Source ..and is currently pointing to :

jdbc:postgresql://localhost:5432/reportingdb

I use RSDB to pull the name of the user currently logged in ..using a datasource parameter LoggedInUserName and a query:

select username from rs_user where $P{_RS_USER_USERNAME} = username

This info is displayed in the jasper report as $P{LoggedInUserName}

Now, when I try to import this report into another instance of RS..and select the default DB as ProdDB after selecting it as a datasource object..and NOT selecting RSDB because it already exists on the new instance..the report crashes because it cannot locate RSDB...However if I select RSDB in the import DB menu..a duplicate of RSDB is created. Is there any other method to do this right ? without the duplication bit..apart from physically configuring each report after every import..

Thanks,

TZM

Offline

#2 2016-09-20 07:04:17

Arno Mittelbach
datenwerke
Registered: 2012-02-14

Re: Unable to link imported rpts to existing d-sources other than default

Hi TZM,

I am afraid that this is currently not possible. You can set a default datasource which is then used for any datasource that is not imported but in your use case this is indeed insufficient and for the time being I think you are stuck with post-processing imported reports.

What I am not quite clear however is whether you need the second datasource in this case. Your datasource parameter LoggedInUserName has a constant expression (for the currently logged in user). So why don't you simply use $P{_RS_USER_USERNAME} within your report to display the user name? $P{_RS_USER_USERNAME} is passed to the execution engine and if you define a string parameter in your jasper report with name _RS_USER_USERNAME you should be able to use it.

Best Regards,
Arno

Offline

Board footer

Powered by FluxBB