sarino Posted July 25, 2017 Share Posted July 25, 2017 I have a JSON datasource I want to feed to a table. Following the steps in http://community.jaspersoft.com/wiki/why-first-record-missing-my-subreport I have created a parameter to store the datasource and set the table with said parameter. To set the parameter, I have written a small scriptlet.public class Scriptlet extends JRDefaultScriptlet { private JRDataSource dataSourceOriginal; @Override public void beforeReportInit() { dataSourceOriginal = (JRDataSource) this.parametersMap.get("REPORT_DATA_SOURCE").getValue(); setData(this.parametersMap, this.fieldsMap, this.variablesMap, this.groups); } @Override public void setData(Map parameters, Map fields, Map variables, JRFillGroup[] groups) { parameters.put("DATASOURCE", dataSourceOriginal); super.setData(parameters, fields, variables, groups); }}[/code]While I can use the Data Source stored in $P{DATASOURCE} but it is missing the first record as well.What am I doing wrong? Link to comment Share on other sites More sharing options...
sanbez Posted July 25, 2017 Share Posted July 25, 2017 https://stackoverflow.com/questions/18787697/table-tool-in-showing-one-fewer-lesser-database-records Link to comment Share on other sites More sharing options...
sarino Posted July 25, 2017 Author Share Posted July 25, 2017 Is it necessary to use a Bean? From what I understand, I should be able to use a JRQuery object to get the data, correct? Link to comment Share on other sites More sharing options...
sanbez Posted July 25, 2017 Share Posted July 25, 2017 I guess in your case you can use JREmptyDataSource for main report and use JSON DataSource as parameter of main report. Probably first record in table will not missing. Link to comment Share on other sites More sharing options...
Solution sarino Posted August 2, 2017 Author Solution Share Posted August 2, 2017 I couldn't find a way to do it using a table component, so I ended up doing a bit of a hack and styled a couple of textfields together with borders. 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