How to separate string getting via parameter by columns ???

0
 
Hello WORLD... :-) 
 
I´m getting a paramenter  $P{columnas}   like string NAME,PROGRAMM,COMPONENT,COUNTRY.
 
My first question is: How could I separate the string NAME,PROGRAMM,COMPONENT,COUNTRY.obtained via parameter by columns ???  I need to replace commas by columns. like  column NAME column PROGRAMM column COMPONENT column COUNTRY
 
My second question is: How could I order my columns Field populated in accordance of my columns order ???  column NAME column PROGRAMM column COMPONENT column COUNTRY
 
 
 
-----------------------------  BEGIN file xml --------------------------------
 
<?xml version="1.0" encoding="UTF-8"?>
<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_02" pageWidth="5095" pageHeight="842" columnWidth="5055" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isTitleNewPage="true" uuid="b59251c3-a56a-4a90-a585-fdf2f679d5ce">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="parametros" uuid="dbe9d210-acf7-41dc-8413-075b1c3fb2bf">
<parameter name="columnas" class="java.lang.String"/>
<queryString language="SQL">
<![CDATA[SELECT CABECERA as columnas FROM TBL_LAYOUT_SIST]]>
</queryString>
<field name="COLUMNAS" class="java.lang.String"/>
<group name="COLUMNAS">
<groupExpression><![CDATA[$F{COLUMNAS}]]></groupExpression>
</group>
</subDataset>
<parameter name="columnas" class="java.lang.String"/>
<field name="ID_BENEFICIARIO" class="java.lang.String"/>
<field name="CURP" class="java.lang.String"/>
<field name="RFC" class="java.lang.String"/>
<field name="AP" class="java.lang.String"/>
<field name="AM" class="java.lang.String"/>
<field name="NOMBRE" class="java.lang.String"/>
<field name="FECHA_NACIMIENTO" class="java.lang.String"/>
<field name="TIPO_PERSONA" class="java.lang.String"/>
<field name="CVE_PROGRAMA" class="java.lang.String"/>
<field name="PROGRAMA" class="java.lang.String"/>
<field name="CVE_COMPONENTE" class="java.lang.String"/>
<field name="COMPONENTE" class="java.lang.String"/>
<field name="MONTO_FEDERAL" class="java.lang.String"/>
<field name="MONTO_ESTATAL" class="java.lang.String"/>
<field name="MONTO_BENEFICIARIO" class="java.lang.String"/>
<field name="ANIO_FISCAL" class="java.lang.String"/>
<field name="FECHA" class="java.lang.String"/>
<field name="ENTIDAD_APLICACION" class="java.lang.String"/>
<field name="ENTIDAD" class="java.lang.String"/>
<field name="MUNICIPIO_APLICACION" class="java.lang.String"/>
<field name="MUNICIPIO" class="java.lang.String"/>
<field name="LOCALIDAD_APLICACION" class="java.lang.String"/>
<field name="LOCALIDAD" class="java.lang.String"/>
<field name="CRUZADA" class="java.lang.String"/>
<field name="CULTIVO_ESPECIE" class="java.lang.String"/>
<field name="CULTIVO" class="java.lang.String"/>
<field name="CANTIDAD" class="java.lang.String"/>
<field name="CVE_APOYO" class="java.lang.String"/>
<field name="APOYO" class="java.lang.String"/>
<field name="ID_RAMO" class="java.lang.String"/>
<field name="BENEFICIARIOS_H" class="java.lang.String"/>
<field name="BENEFICIARIOS_M" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="32">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="100" height="20" uuid="82f4bf59-252f-4f5c-92a4-7fd212399bda"/>
<textElement>
<font fontName="Arial" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}]]></textFieldExpression>
</textField>
</band>
</title>
<detail>
<band height="30" splitType="Stretch">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="292" y="0" width="60" height="20" isRemoveLineWhenBlank="true" uuid="e5c7248b-fbe3-4a3d-89e1-dd90c5a2005f"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("CURP") ? $F{CURP}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="222" y="0" width="53" height="20" isRemoveLineWhenBlank="true" uuid="e3688cd0-9a8c-4f31-b676-2bcb383e3720"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("RFC") ? $F{RFC}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="91" y="0" width="46" height="20" isRemoveLineWhenBlank="true" uuid="f7bb4ded-8c84-4966-93f1-f685337a99c8"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("AP") ? $F{AP}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="159" y="0" width="42" height="20" isRemoveLineWhenBlank="true" uuid="08388953-c18c-4554-826c-543b7971e1a6"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("AM") ? $F{AM}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
<reportElement x="0" y="0" width="71" height="20" isRemoveLineWhenBlank="true" uuid="89254f9f-83d5-4067-b51e-11dea9f0b946"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("NOMBRE") ? $F{NOMBRE}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="372" y="0" width="107" height="20" isRemoveLineWhenBlank="true" uuid="50e9ef9d-54a0-4fb5-aa91-f8d9a178cae3"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("TIPO_PERSONA") ? $F{TIPO_PERSONA}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="500" y="0" width="90" height="20" isRemoveLineWhenBlank="true" uuid="08ec4e56-4219-4675-bd57-de6debde082a"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("PROGRAMA") ? $F{PROGRAMA}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="613" y="0" width="102" height="20" isRemoveLineWhenBlank="true" uuid="dc7547b8-220f-4166-acc7-2d663ef097a9"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("COMPONENTE") ? $F{COMPONENTE}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement x="1053" y="0" width="122" height="20" isRemoveLineWhenBlank="true" uuid="d42cb999-3a89-4a1f-8565-8d7384abae24"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("MONTO_FEDERAL") ? $F{MONTO_FEDERAL}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement x="1192" y="0" width="122" height="20" isRemoveLineWhenBlank="true" uuid="e745d88c-7fe1-40c6-9ab0-ea489308faad"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("MONTO_ESTATAL") ? $F{MONTO_ESTATAL}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement x="1330" y="0" width="146" height="20" isRemoveLineWhenBlank="true" uuid="4bbee5ca-b664-4f33-abc4-222568f46f36"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("MONTO_BENEFICIARIO") ? $F{MONTO_BENEFICIARIO}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement x="1491" y="0" width="100" height="20" isRemoveLineWhenBlank="true" uuid="dc88dc69-bd0c-4c3b-b88a-c61e6adfebd0"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("ANIO_FISCAL") ? $F{ANIO_FISCAL}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="1607" y="0" width="67" height="20" isRemoveLineWhenBlank="true" uuid="71fbd34f-a72c-432c-b532-1a5719997c2e"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("FECHA") ? $F{FECHA}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="730" y="0" width="77" height="20" isRemoveLineWhenBlank="true" uuid="51cffeb0-b5fa-452c-b693-be8516293b6b"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("ENTIDAD") ? $F{ENTIDAD}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="823" y="0" width="98" height="20" isRemoveLineWhenBlank="true" uuid="aeb0111c-372f-4a31-b632-9b81489c96fe"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("MUNICIPIO") ? $F{MUNICIPIO}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="939" y="0" width="100" height="20" isRemoveLineWhenBlank="true" uuid="c0ad9fb6-d453-4607-b583-353086a85c52"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("LOCALIDAD") ? $F{LOCALIDAD}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="1970" y="0" width="74" height="20" isRemoveLineWhenBlank="true" uuid="9d0985a5-ecb6-470f-997b-4812e0a09bb3"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("CRUZADA") ? $F{CRUZADA}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="1687" y="0" width="80" height="20" isRemoveLineWhenBlank="true" uuid="a28b7f2e-2d95-48fd-82b6-26f02a9cc5d4"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("CULTIVO") ? $F{CULTIVO}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="1794" y="0" width="67" height="20" isRemoveLineWhenBlank="true" uuid="de0662de-be8f-4efe-973d-4f91bd6c1a57"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("APOYO") ? $F{APOYO}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="1877" y="0" width="77" height="20" isRemoveLineWhenBlank="true" uuid="866bae32-a247-4690-a511-47503c6e9d7d"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("ID_RAMO") ? $F{ID_RAMO}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="2066" y="0" width="125" height="20" isRemoveLineWhenBlank="true" uuid="a56ff5cd-4db2-4f4f-8150-2fab97570cdd"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("BENEFICIARIOS_H") ? $F{BENEFICIARIOS_H}:""]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="2209" y="0" width="122" height="20" isRemoveLineWhenBlank="true" uuid="14a71b5e-7b90-4c7d-b16f-bfb83bbd6c62"/>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnas}.contains("BENEFICIARIOS_M") ? $F{BENEFICIARIOS_M}:""]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
 
-----------------------------  BEGIN file jxml --------------------------------
 
 
 
-----------------------------  BEGIN file ManagedBean --------------------------------
 
      Map<String, Object> param = new HashMap<String, Object>();
      param.put("columnas",parameters.getColumnas());
      //JRBeanCollectionDataSource beanCollectionDataSource=new JRBeanCollectionDataSource(listAll); 
      String reportPath= FacesContext.getCurrentInstance().getExternalContext().getRealPath("reports/report_02.jasper"); 
      jasperPrint=JasperFillManager.fillReport(reportPath, 
      param, new JRBeanCollectionDataSource(listAll)); 
      System.out.println("reportPath> "+reportPath);
 
-----------------------------  END file ManagedBean--------------------------------
 
any suggestions for me ????  Please... Help me....
 
Regards....
benjaminvera's picture
Joined: Dec 5 2013 - 3:35pm
Last seen: 3 years 11 months ago

0 Answers:

No answers yet
Feedback