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

Yuri Savochenko

Members
  • Posts

    30
  • Joined

  • Last visited

Community Answers

  1. Yuri Savochenko's post in WHERE TO PUT .JASPER FILE? was marked as the answer   
    Your flow can be:
    1. create via REST2 new jrxml file in JRS repository. to do that use 2.2.4 PUT request, but inside String resource-descriptor just put your jrxml data
    2. create new datasource (if needed)
    3. create new jasperreport that uses your previously uploaded jrxml. check especially 2.2.1, there you can find sample resource descriptor for jasperreport or datasource, which you can take as the reference for creating new reports via webservices (2.2.4) (just put your properties/datasource repo path/jrxml repo path/) 
    4. after jasperreport was created, then you can run it as said in 3.1.1 (JRS will automatically compile jasperreport)
    Also if you consistently run few reports, maybe it would be easier to define them in JRS using WebGUI or uploading the report from iReport into JRS repositor, otherwise you will have to use REST services to create jrxml/create datasource/create report/run report
     
     
  2. Yuri Savochenko's post in How to create an Excel data source in JasperReports Server? was marked as the answer   
    Hi, here are the proper steps to resolve this issue:
    1. Get your xls file (data should be stored in columns, smth like JR table report) and rename it to xls_data.xml
    2. Upload it to the server with the name xls_data into /reports folder
    3. Create xls_data_provider.xml, like:
    <?xml version="1.0" encoding="UTF-8"?><xlsDataAdapter class="net.sf.jasperreports.data.xls.XlsDataAdapterImpl"> <name>ExcelData</name> <fileName>repo:/reports/xls_data</fileName><useFirstRowAsHeader>true</useFirstRowAsHeader><queryExecuterMode>false</queryExecuterMode><datePattern>yyyy-MM-dd HH:mm:ss</datePattern><columnNames>city</columnNames><columnNames>country</columnNames><columnNames>state</columnNames><columnIndexes xmlns:xsi="http: //www.w3.org/2001/XMLSchema-instance" xsi:type="java:java.lang.Integer">0</columnIndexes><columnIndexes xmlns:xsi="http: //www.w3.org/2001/XMLSchema-instance" xsi:type="java:java.lang.Integer">1</columnIndexes><columnIndexes xmlns:xsi="http: //www.w3.org/2001/XMLSchema-instance" xsi:type="java:java.lang.Integer">2</columnIndexes></xlsDataAdapter> Note that all your xml-tags should be in CamelCase as it is defined in net.sf.jasperreports.data.xls.XlsDataAdapterImpl. Also note that your xls data file should contain the first row with column names and those names should be the same as defined in <columnNames> tags 4. Upload your xls_data_provider.xml as xls_data_provider into the /reports folder5. Create report in iReport or JSS using XLS file (the original one). After all fields were added view report as xml and add few more lines: <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="report" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="ec8d891c-4188-4de7-b77f-71d1440b831f"><property name="net.sf.jasperreports.data.adapter" value="repo:/reports/xls_data_provider "/><queryString language="xls"><![CDATA[]]></queryString><field name="city" class="java.lang.String"/><field name="country" class="java.lang.String"/>6. In JRS goto Add new report and use previously created jrxml, don't select any datasource in wizard
    It's done, now you should be able to run report.
×
×
  • Create New...