gabriel.nadoroski Posted October 3, 2018 Share Posted October 3, 2018 Hi, I need help, I am sending the parameter in array, to printed in the report the problem is:It is printed like this:"[ex]"And I need to print like this, like a table:ex1-----ex2I don't use a query to send the parameters, I sending for a array using a framework in php, is just a test to implement in a real report, I just need know how I can do that, someone can help ? Link to comment Share on other sites More sharing options...
sadakar Posted October 3, 2018 Share Posted October 3, 2018 If your need is to remove square brackets I think below should be of helphttps://community.jaspersoft.com/blog/tip-remove-and-collection-parameter-jasper-reports Link to comment Share on other sites More sharing options...
gabriel.nadoroski Posted October 3, 2018 Author Share Posted October 3, 2018 Thanks !This helpful, but I need broke him in lines, like a table in execl.Let's see, I think this can help you understand my problem.I am doing a query in PHP in the database, that query brings to me a quantity of payments and the date of this payments, and I need to make a table with that data in xls. Link to comment Share on other sites More sharing options...
Solution reportdev Posted October 5, 2018 Solution Share Posted October 5, 2018 you need to convert the List to JRBeanCollectionDataSource in order for it to iterate and use a List element<?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="Iterator" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="20f55d6a-1496-430d-8dde-cdb41d7b53ac"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <subDataset name="Dataset1" uuid="a32a36ba-2e14-4071-9649-c5738d43e63a"> <queryString> <![CDATA[]]> </queryString> <field name="_THIS" class="java.lang.String"/> </subDataset> <parameter name="arrayAccepter" class="java.util.List"> <defaultValueExpression><![CDATA[Arrays.asList("Hello1", "Hello2", "Hello3", "Hello4")]]></defaultValueExpression> </parameter> <queryString> <![CDATA[]]> </queryString> <background> <band splitType="Stretch"/> </background> <detail> <band height="90"> <textField> <reportElement x="0" y="0" width="290" height="30" uuid="5208b9c8-6128-4f52-90de-7d93bbd0294e"/> <textFieldExpression><![CDATA[$P{arrayAccepter}.toString()]]></textFieldExpression> </textField> <componentElement> <reportElement x="0" y="60" width="100" height="30" uuid="b014b59d-186c-42cd-b975-a7a1ca18ca9f"/> <jr:list 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="Dataset1" uuid="b3c55d8f-90d9-4ddc-9fa1-66da2cb48783"> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{arrayAccepter})]]></dataSourceExpression> </datasetRun> <jr:listContents height="30" width="100"> <textField> <reportElement x="0" y="0" width="100" height="30" uuid="c6bd4e2a-e756-4089-bdf7-9b06b5575201"/> <textFieldExpression><![CDATA[$F{_THIS}]]></textFieldExpression> </textField> </jr:listContents> </jr:list> </componentElement> </band> </detail></jasperReport>[/code] Link to comment Share on other sites More sharing options...
gabriel.nadoroski Posted October 8, 2018 Author Share Posted October 8, 2018 Thanks reportdev!You saved me, I giving up doing of make the report in jaspersoftBut you saved me, your answer helped me. 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