Jump to content
Changes to the Jaspersoft community edition download ×

Choose Datasource in a report schedule job using rest api


Recommended Posts

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

The datasource declaration is part of the ReportUnit(http://community.jaspersoft.com/documentation/tibco-jasperreports-server-user-guide/v630/overview-report-unit). Some report units might use a datasource, others might not.

When viewing a job definition with the jobs Service (http://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v630/jobs-service#Viewing_a_Job_Definition) you could grab the reportUnitURI from the response and use it with the resources service.

With cUrl you would write something like this:

curl -u jasperadmin:jasperadmin -H "Accept:application/json" http://localhost:8080/jasperserver/rest_v2/resources/{paht/to/ReportUnit}?expanded=true

Link to comment
Share on other sites

When I use the Resources Service to modify Datasource, it applies to all subsequent executions of the report.


For example, I create a report schedule "MyReport" with datasource "Ds1" to run at 12:00.


After, I create another report schedule "MyReport" with datasource "Ds2" to run at 10:00.


In both cases I have used the Resources Service to modify the Datasource.


When running the 12:00 schedule it will assume the last modified datasource by Resources Service, in the case "Ds2". But when I scheduled, it was to use the datasource "DS1".


There is some way to get around this.

Link to comment
Share on other sites

Switching datasources like that is not possible right now out of the box, but will be in the upcoming release(6.4) through the use of Dataset propertyExpressions(that you set when designing the report JRXML template - and not when creating the ReportUnit) where you could use a parameter that could specify the datasource repository location. This should go hand in hand with the scheduled report's parameters.

Other ways to get there could involve developing:

Link to comment
Share on other sites

  • 9 months later...

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