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

reportdev

Members
  • Posts

    413
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by reportdev

  1. https://stackoverflow.com/questions/3737992/noclassdeffounderror-org-slf4j-impl-staticloggerbinder It looks like you need add additional dependencies
  2. http://jasperreports.sourceforge.net/sample.reference/query/index.html#clause_functions check that community page. you will get more info from that page
  3. iReports is not supported. please use Jasper Studio and see if this problem still exists.
  4. there are so many community posts, which can guide you through exporting the jasperprint to a browser. please check those. https://community.liferay.com/forums/-/message_boards/message/10540696
  5. Hi Team, My user reputation went down nearly 350 points on Jun 27, 2018. I think this is a bug in the community site. please check.
  6. I'm using JFrame here, but you can change it to something else. public static void main(String[] args) throws ParseException, SQLException, JRException { Connection con = DriverManager.getConnection("jdbc:oracle", "user","password"); java.sql.Date sqlDate = new java.sql.Date((new SimpleDateFormat("MM/dd/yyyy").parse("07/01/2018")).getTime()); Map parameters = new HashMap(); Map<String, String> temp = new HashMap<String, String>(); parameters.put("paramName", sqlDate); String workingDir = System.getProperty("user.dir"); String file = workingDir + "\src\resources\main_jrxml.jasper"; System.out.println("Current working directory : " + file); JasperReport report = (JasperReport) JRLoader.loadObjectFromFile(file); JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, con); JFrame frame = new JFrame("Report"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new JRViewer(jasperPrint)); frame.pack(); frame.setVisible(true); }}[/code]
  7. That was really a good question, have been working on Jasper for awhile for but did not ask myself that question. Here is your answer: https://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-user-guide/v640/datasets-and-subdatasets In short, you cannot use the main dataset for the tables/charts/tables. If you do not want to make two calls to the database, then you can use this below strategy. (i'm using Oracle database, but you can find same functionality in other databases too) The main dataset will initiate the report connection with "select * from dual"Write your main query in the sub dataset. Send the same REPORT_CONNECTION to the sub dataset.
  8. If you dont need all the fancy report features, you can use the Jasper Community Edition. https://community.jaspersoft.com/community-download I believe TIBCO does not provide lifetime licenses, its all yearly. You can check this page https://www.jaspersoft.com/editions and contact TIBCO suppport for prices.
  9. Create a new dataset in your report called as parameter count Use the same sql as the parameter is using, instead of getting any columns, get a count of parameter values Create a Table element based on the above dataset and write a ternary expression to display the "ALL" or Something else. Here is a sample jrxml <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.4.2.final using JasperReports Library version 6.4.1 --><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="parameterCount" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="afcffb2c-62fc-41ec-9f38-8f5ffbf1e460"> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="paramCount" uuid="da6302aa-23ff-4f8c-ba13-809fe1a79241"> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <parameter name="arrayListParam" class="java.util.ArrayList"> <defaultValueExpression><![CDATA[Arrays.asList("1", "2", "3")]]></defaultValueExpression> </parameter> <queryString language="SQL"> <![CDATA[select count(*) as totalCount from ( select 1 from dual union select 2 from dual union select 3 from dual )]]> </queryString> <field name="TOTALCOUNT" class="java.math.BigDecimal"/> </subDataset> <parameter name="arrayListParam" class="java.util.ArrayList"> <defaultValueExpression><![CDATA[new ArrayList(Arrays.asList("1", "2", "3"))]]></defaultValueExpression> </parameter> <queryString> <![CDATA[select * from dual]]> </queryString> <field name="DUMMY" class="java.lang.String"/> <background> <band splitType="Stretch"/> </background> <title> <band height="30" splitType="Stretch"> <staticText> <reportElement x="0" y="0" width="802" height="30" uuid="79b34a17-1afc-4f38-a307-b09ef0af02ca"/> <text><![CDATA[Parameter All]]></text> </staticText> </band> </title> <detail> <band height="30" splitType="Stretch"> <componentElement> <reportElement x="0" y="0" width="802" height="30" uuid="dbadd6a6-8363-411e-a34f-6736d5c0f7c3"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> <property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/> <property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/> <property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/> </reportElement> <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetRun subDataset="paramCount" uuid="81c160d1-35bf-4abd-a6e9-a87f7a0338d8"> <datasetParameter name="arrayListParam"> <datasetParameterExpression><![CDATA[$P{arrayListParam}]]></datasetParameterExpression> </datasetParameter> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> </datasetRun> <jr:column width="200" uuid="0651b07b-5ea1-4d1b-990e-ccb134c9b7fb"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/> <jr:detailCell style="Table_TD" height="30"> <box> <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> </box> <textField> <reportElement x="0" y="0" width="200" height="30" uuid="ba8e0370-1610-4fdd-aac8-4bce9911c3b5"/> <textElement> <font size="14"/> </textElement> <textFieldExpression><![CDATA[$F{TOTALCOUNT}.intValue() == $P{arrayListParam}.size() ? "All" : $P{arrayListParam}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:table> </componentElement> </band> </detail></jasperReport>[/code]
  10. See this... https://community.jaspersoft.com/wiki/ireport-calling-stored-procedures For Oracle, Jasper provides a parameter called ORACLE_REF_CURSOR, but in postgres, could not find any such paraneter
  11. I have tried it and it does not work... probably you will end up with 2 parameters. One to select the "Please take x tablets daily", Second to select number of tablets
  12. Cascading parameters. https://community.jaspersoft.com/blog/cascading-parameters-jasper-reports-0 Read more about cascading parameters concept. Once the user selects a first parameter, the list value would be sent into the second parameter SQL where clause
  13. if you have bought a TIBCO license, then you can download it from their support site called edelivery.tibco.com
  14. This is how you can create a rest v2 call http://localhost:8080/jasperserver/rest_v2/reports/reports/reportname.pdf?parameter_name=somevalue More Info - https://community.jaspersoft.com/wiki/getting-started-rest-web-service-api You need to have the jrxml uploaded to the server before making rest call
  15. You need to add a style to the jrxml. Add below code after JRXML properties like this. <style name="RowBanding"> <conditionalStyle> <conditionExpression><![CDATA[$V{REPORT_COUNT}%2==0]]></conditionExpression> <style mode="Opaque" backcolor="#F2F2F2"/> </conditionalStyle> </style> Then apply the Style Rowbanding to the Text Fields in detail band
  16. @Matthew... remove the Correct Answer Tag from Hozawa's post if you feel you did not get the answer, so that Other users can comment on this post. Otherwise it not allowing other users to answer. Below is the code that i wrote in java for the same purpose... try to salvage some code and write your own scriptlet in jasper reports. /*Imports : Commons-beanutils Commons-digester Commons-logging Jasperreports Ojdbc Org.apache.commons.collections */ import java.io.FileOutputStream; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; import javax.swing.JFrame; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.pdf.PdfCopy; import com.lowagie.text.pdf.PdfImportedPage; import com.lowagie.text.pdf.PdfReader; import com.lowagie.text.pdf.PdfWriter; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.export.JRPdfExporter; import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.export.ExporterInput; import net.sf.jasperreports.export.SimpleExporterInput; import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput; import net.sf.jasperreports.export.SimplePdfExporterConfiguration; import net.sf.jasperreports.swing.JRViewer; public class JasperReportFillWithSplitPDF { @SuppressWarnings("unchecked") public static void main(String[] args) throws SQLException, IOException, DocumentException { try { Connection con = DriverManager.getConnection("jdbcConnectionStrings); // opens a jdbc connection String reportName = "reportJrxml"; JasperReport report = (JasperReport) JRLoader.loadObjectFromFile("C:/" + reportName + ".jasper"); Map parameters = new HashMap(); JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, con); JFrame frame = new JFrame("Report"); frame.getContentPane().add(new JRViewer(jasperPrint)); frame.pack(); frame.setVisible(true); JRPdfExporter exporter = new JRPdfExporter(); ExporterInput inp = new SimpleExporterInput(jasperPrint); exporter.setExporterInput(inp); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(reportName + ".pdf")); SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration(); configuration.setPermissions(PdfWriter.ALLOW_PRINTING | PdfWriter.ALLOW_COPY); exporter.setConfiguration(configuration); exporter.exportReport(); exporter.setExporterOutput(null); String inFile = new String(reportName + ".pdf"); PdfReader reader = new PdfReader(inFile); int n = reader.getNumberOfPages(); int i = 0; while ( i < n ) { String outFile = inFile.substring(0, inFile.indexOf(".pdf")) + "-" + String.format("%03d", i + 1) + ".pdf"; System.out.println ("Writing " + outFile); Document document = new Document(reader.getPageSizeWithRotation(1)); PdfCopy writer = new PdfCopy(document, new FileOutputStream(outFile)); document.open(); PdfImportedPage page = writer.getImportedPage(reader, ++i); writer.addPage(page); document.close(); writer.close(); } } catch (JRException e) { e.printStackTrace(); } } }
  17. First Read this https://community.jaspersoft.com/wiki/how-use-multiple-data-sources-jaspersoft-studio-or-jasperreports-server and if not working then I think this is possible. but it needs some java coding. Main dataset would query Excel spreadsheet - this is normal Subreport dataset would query Oracle - this is where it gets tricky usually the same connection string is passed in to the subreport from the main report. but here two different datasources should be used, so REPORT_DATA_SOURCE parameter for the subreport from main report should be set to Oracle. If you are using java to generate this report, then you can pass this REPORT_DATA_SOURCE (JRDataSource object) parameter into the main report and then pass it into the subreport
  18. https://community.jaspersoft.com/sites/all/libraries/pdf.js/web/viewer.html?file=/sites/default/files/docs/jasperreports-server-admin-guide.pdf#G13.1012091 apache-tomcatwebappsjasperserverWEB-INFapplicationContext.xml add your timezone to the bean "userTimeZonesList"
  19. create a blank group and put that table in either group header / group footer. detail band iterates over the dataset resultset, so it repeats itself. instead you can use summary also.
  20. I would suggest create a jrxml with a subreport in it. Main report should accept some arraylist as parameterGroup based on each arraylist valuein the group bands, create a subreport (which is your actual pdf layout)when you make a rest call, send the parameter and generate multiple page pdf and then write some code to split multiple page pdf to single page pdf
  21. can i ask you the purpose of moving this band ? Each band has its specific purpose and if it does not serve your purpose, you can change the properties on elements being used inside a band and display them as you like.
  22. either it be production or test environment, jasper server used REST API and it is the only way you can build a report path... since the reports could have parameters, REST API will provide an easy way for you to provide parameter values. If you dont want to use Jasper Server, then you can call the reports from a java service using jasper api.
  23. @andrew_50 you either need to know how to write a stored procedure or a java scriptlet. both the implementations perform the same output. I would suggest you should think about writing a mysql procedure first and then implement it in jasper. try writing a mysql procedure which should output a cursor and this cursor can be used for displaying the report. inside the same procedure, you should update the records that have been fetched by the cursor.
  24. did you check this post ? https://community.jaspersoft.com/questions/1076991/generate-unique-document-number
  25. REST API can be used for creating the links to jasper reports. Try this link https://community.jaspersoft.com/documentation/jasperreports-server-web-services-guide/v56/running-report
×
×
  • Create New...