#1 2016-12-06 18:57:45

bpeikes
Member
Registered: 2016-10-29

Techniques for switching datasources

Let's say you have 3 datasources, each pointing to a different instance of your databases. For instance, dev, staging, production. Is there anyway to have a report where the datasource can be chosen at run time?

Offline

#2 2016-12-06 22:52:02

karolina
Member
Registered: 2014-08-09

Re: Techniques for switching datasources

Yes, for this you can use a database bundle (it is available in the RS Enterprise Edition)

You'll find some introduction here

To assign the datasource when running a report, choose Parameter as the key provider and add a key of the parameter (for example: dataSource) you'll later use to choose the data source.

With only 3 datasources, the static mapping should be sufficient for you. Here you manually set a key for each datasource in the bundle (for example: dev, stage, prod) and you manually choose the datasources from the list of available datasources.

In the report you specify the bundle as the report's data source. As the parameter that determines the assigned datasource you may use a datasource parameter. The key of the parameter should be the same as specified at the bundle configuration (here: dataSource).

The datasource of the parameter can be a CSV data source. (Whether to choose the text connector or the argument connector depends where you want to define the list of values, respectively: at the datasource config or at the datasource parameter config. I prefer the text connector, as it allows to reuse the CSV datasource in many reports). The first column in the CSV datasource should contain the keys of the datasources you defined in the static mapping (here: dev, stage, prod). The second column should contain a display value (a more descriptive, user-friendly label, like: Development, Staging, Production)

Hope it helps. If anything is unclear, let me know.

Karolina

Last edited by karolina (2016-12-06 22:53:37)

Offline

Board footer

Powered by FluxBB