Jump to content
We've recently updated our Privacy Statement, available here ×

ignacio.coca

Members
  • Posts

    8
  • Joined

  • Last visited

ignacio.coca's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. When visualizing my report in Jasper, text fields with ">" or "<" appears OK, but when I export it to PDF, these symbols don't appear mid-aligned in the text, but in the bottom side. Is there a solution? Thanks!
  2. I found this problem in another forum, where the solution is given, but I do not understand it. It says: //---------------- Solution : You have to rewind the datasource using JRRewindableDataSource Thanks to lucianc Community answer Summarizing on the tasks : Create a wrapper RewindableDSWrapper that rewinds a data source and delegates all the calls to it. package com.jasper.api; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRField; import net.sf.jasperreports.engine.JRRewindableDataSource; public class RewindableDSWrapper implements JRRewindableDataSource { private final JRRewindableDataSource ds; public RewindableDSWrapper(JRRewindableDataSource ds) { this.ds = ds; try { this.ds.moveFirst(); } catch (JRException e) { e.printStackTrace(); } } public boolean next() throws JRException { return ds.next(); } public Object getFieldValue(JRField jrField) throws JRException { return ds.getFieldValue(jrField); } public void moveFirst() throws JRException { ds.moveFirst(); } } In your custom data source class implement JRRewindableDataSource interface. public void moveFirst() throws JRException { // provide logic for rewinding datasource } In your jrxml file, if your datasource is custom one then <dataSourceExpression><![CDATA[new com.jasper.api.RewindableDSWrapper((JRRewindableDataSource)$P{REPORT_DATA_SOURCE})]]></dataSourceExpression> you cast REPORT_DATA_SOURCE to JRRewindableDataSource as the compiler will try to cast it to JRDataSource. Also add the jar file containing RewindableDSWrapper class to classpath in your studio. ----------------// The problem is that I don't know how to implement this in my report. Where must I write all this code? Thank you!!
  3. I know that it is an old topic, but I have the same issue. My question is: Where must I write each part of the code? When writting on the Source window, I get the error: "CANNOT FIND THE DECLARATION OF ELEMENT 'br'". Thanks!
  4. Hi all. I have now another issue related to subreports in JasperStudio. I have in my main report some groups displaying my data ok. The data is shown in 5 detail sections, one for each group header (my report must have seven different sections). In the sixth section I need to use a subreport. I use the subreport in the 6th group header, and it is displayed OK. I can see the detail sections from 1 to 5, and the subreport. The problem comes when I put data into the 7th detail section. Basically, it does not display nothing. It seems that the subreport has used all the rows of my CSV and the main report has no more data. If I delete the subreport in the 6th group, I can see the data in the 7th one, so I am sure that the problem is the subreport. What can I do? Thank you!!
  5. Hello. I have been thinking and looking for info and I think that the problem now could be because of the indices. The point is that when my subreport is used, there is some data that has been used by the main report, so the subreport seems not to work for the first lines. Is that possible? If this is the problem, is there any way to make my subreports to work for all data and not just for the ones that are not used in the main report? Thank you very much!! I think I am really close to solve it thank to you :D:D
  6. Thank you Javier. I already did what you said, but when running the report I get "The method subDataSource() is undefined for the JRDataSource". I tried to put in the expression just $P{REPORT_DATA_SOURCE}, and with this, one of my subreports is half-working: I see part of my data even in the detail section, but not everything (just seeing some of the rows in details). I think I am really lost xD I am using Jaspersoft Studio. Thank you
  7. I can not comment your post neither. I do not know if I understood what you said. When I drag the subreport item to the main report, In the Connection type I can choose between: - Use same JDBC connection used to fill the master report - Use another connection - Use an empty Data Source - Use a JRDatasource expression From what you said, I should use. "use another connection", and write the expression you said. Am i OK? Anyway, when I do this and preview, I get the error: "The method subDataSource() is undefined for the type JRDataSource", so I am doing something wrong. When I started this thread, I thought it could be an error in passing parameters to the subreport, since I am using Fields and not Parameters, but seems that there are too many errors in what I am doing. I really thank you for your answers, since I need to do this for my job and I am really confused. Thank you!!
  8. Hi everyone. I'm new to Jasper and I have a big problem inserting Subreports from CSV. I've been looking for information for 3 days and can not understand what must I do. I have a dataset named RB1 in csv format, that I need to import to Jasper. In the main report I have no problems, I can import it and show fields as I want. The problem arises when I need to insert a subreport wirh the same database. I create another report named SUB_1, and link it to the database RB1 as if it was an usual report, and I put the variable COLUMN_0 to be shown in the details section. I previsualize it and it is OK. I go back to the main report and drag the item SUBREPORT to the summary section and select "select an existing report". I choose the report SUB_1 -> NEXT I select "use same JDBC connection used to fill the master report" -> NEXT In the Dataset Parameters I clic ADD and write: PARAMETER NAME: COLUMN_0 PARAMETER EXPRESSION: $F{COLUMN_0} What I'm trying to do is to link the variable COLUMN_0 of the main report with the variable COLUMN_0 in the subreport. Now, when I try to previsualize the report, the subreport does not show. In the Properties of the Subreport I have: EXPRESSION: "SUB_1" PARAMETERS MAP EXPRESSION: CONNECTION EXPRESSION: $P{REPORT_CONNECTION} DATA SOURCE EXPRESSION: What am I doing wrong? I guess that many things, but could not find any answer online with this in detail in a way that I can understand it. Thank you very much!!!!
×
×
  • Create New...