mmmartins Posted March 15, 2017 Share Posted March 15, 2017 There are several datasources listed on the JasperReports Server. How do I tell which datasource will be used in a report schedule using rest api? Link to comment Share on other sites More sharing options...
narcism Posted March 17, 2017 Share Posted March 17, 2017 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 More sharing options...
mmmartins Posted March 17, 2017 Author Share Posted March 17, 2017 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 More sharing options...
narcism Posted March 20, 2017 Share Posted March 20, 2017 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:a ParameterContributor extension(http://community.jaspersoft.com/wiki/parameter-contributors)or, for more advanced use cases, a Custom Datasource(http://community.jaspersoft.com/documentation/tibco-jasperreports-server-ultimate-guide/v630/custom-data-sources) Link to comment Share on other sites More sharing options...
mmmartins Posted December 26, 2017 Author Share Posted December 26, 2017 Is the above implementation already available in version 6.4.2 as provided in the previous answer? 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