1 Reply Latest reply on Apr 11, 2012 12:08 PM by cacelis

    Problem passing parameters to BIRT reports from JSF pages with Seam [solved]

    cacelis

      Hi.

       

      I have other problem when I try to send the parameters from JSF page to a BIRT report.

      The problem is, the parameter values aren't arriving to the report.

      If I print the values selected in the list, I can see them in the display but, they don't arrive to the report. Otherwise, If I try to send constant values in the attribute "value" of the tag "b:param" (for example, <b:param name="OficinaVentas" value="OFICINA1" />), the parameters arrive to the report.

       

      Code is here:

       

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:s="http://jboss.com/products/seam/taglib"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:a4j="http://richfaces.org/a4j"
          xmlns:birt="http://www.eclipse.org/birt/taglibs/birt.tld"
          xmlns:b="http://jboss.com/products/seam/birt">
      
      
      <ui:composition template="/layout/template.xhtml">
          <ui:define name="body">
              <h:form id="homeForm">
                  <rich:panel id="panelConfigReporte">
                      <f:facet name="header">
                          <h:outputText value="Reporte - Ventas y Devoluciones" />
                      </f:facet>
                      <table align="center">
                          <tr>
                              <td><h:outputText value="Fecha Inicio:" /></td>
                              <td><rich:calendar id="fecha_inicio" datePattern="dd/MM/yyyy"
                                      popup="true" locale="CO" enableManualInput="false"
                                      value="#{report.report.fechaInicio}">
                                  </rich:calendar></td>
                              <td><h:outputText value="Fecha Fin:" /></td>
                              <td><rich:calendar id="fecha_fin" datePattern="dd/MM/yyyy"
                                      popup="true" locale="CO" enableManualInput="true"
                                      value="#{report.report.fechaFin}">
                                  </rich:calendar></td>
                              <td><h:outputText value="Organización de Ventas" /></td>
                              <td><h:selectManyListbox id="organizacion"
                                      value="#{report.report.organizacionVentas}" size="10">
                                      <s:selectItems value="#{listaOrganizaciones}"
                                          var="_organizacion"
                                          itemValue="#{_organizacion.idOrganizacionVentas}"
                                          label="#{_organizacion.organizacionVentas}">
                                      </s:selectItems>
                                  </h:selectManyListbox></td>
                              <td><h:outputText value="Oficina de Ventas" /></td>
                              <td><h:selectManyListbox id="oficina"
                                      value="#{report.report.oficinaVentas}" size="10">
                                      <s:selectItems value="#{listaOficinaVentas}" var="_oficina"
                                          itemValue="#{_oficina.idOficinaVentas}"
                                          label="#{_oficina.oficinaVentas}">
                                      </s:selectItems>
                                  </h:selectManyListbox></td>
                              <td><h:outputText value="Canal de Distribución" /></td>
                              <td><h:selectManyListbox id="canal"
                                      value="#{report.report.canalDistribucion}" size="10">
                                      <s:selectItems value="#{listaCanalDistribucion}" var="_canal"
                                          itemValue="#{_canal.idCanalDistribucion}"
                                          label="#{_canal.canalDistribucion}">
                                      </s:selectItems>
                                  </h:selectManyListbox></td>
                              <td><h:outputText value="Grupo de Ventas" /></td>
                              <td><h:selectManyListbox id="grupo"
                                      value="#{report.report.grupoVentas}" size="10">
                                      <s:selectItems value="#{listaGrupoVentas}" var="_grupo"
                                          itemValue="#{_grupo.idGrupoVendedor}"
                                          label="#{_grupo.grupoVendedor}">
                                      </s:selectItems>
                                  </h:selectManyListbox></td>
                              <td><h:outputText value="Responsable de Pago" /></td>
                              <td><h:inputText value="#{report.report.responsablePago}" />
                              </td>
                          </tr>
                          <tr>
                              <td colspan="14" align="center"><h:commandButton id="generar"
                                      action="#{report.generateReport()}" value="Visualizar reporte" />
                              </td>
                          </tr>
                      </table>
                  </rich:panel>
                  <rich:panel id="panelReporte"
                      rendered="#{report.report.fechaFin != null and report.report.fechaInicio != null
                       and report.report.organizacionVentas != null and report.report.oficinaVentas != null
                       and report.report.canalDistribucion != null and report.report.grupoVentas != null
                       and report.report.responsablePago != null}">
                      <f:facet name="header">
                          <h:outputText value="Reporte consolidado" />
                      </f:facet>
                      <table align="center">
                          <tr align="center">
                              <td align="center">
                                  <b:birt designName="/report/design/reporteVentasDevolucionesConsolidado.rptdesign"
                                      designType="embed" format="html" embeddable="true">
                                      <b:param name="OrganizacionVentas"
                                          value="#{report.report.organizacionVentas != null ? report.report.organizacionVentaString : ''}" />
                                      <b:param name="OficinaVentas"
                                          value="#{report.report.oficinaVentas != null ? report.report.oficinaVentaString : ''}" />
                                      <b:param name="CanalDistribucion"
                                          value="#{report.report.canalDistribucion != null ? report.report.canalDistribucionString : ''}" />
                                      <b:param name="GrupoVentas"
                                          value="#{report.report.grupoVentas != null ? report.report.grupoVentaString : ''}" />
                                      <b:param name="ResponsablePago"
                                          value="#{report.report.responsablePago != null ? report.report.responsablePago : ''}" />
                                  </b:birt>
                                  <h:outputText value="#{report.report.organizacionVentaString}" /><br />
                                  <h:outputText value="#{report.report.oficinaVentaString}" /><br />
                                  <h:outputText value="#{report.report.canalDistribucionString}" /><br />
                                  <h:outputText value="#{report.report.grupoVentaString}" /><br />
                                  <h:outputText value="#{report.report.responsablePago}" />
                              </td>
                          </tr>
                          <tr align="center">
                              <td align="center">
                                  <h:commandButton id="ver_detalles"
                                      action="#{report.viewDetails()}" value="Ver detalles" />
                              </td>
                          </tr>
                      </table>
                  </rich:panel>
              </h:form>
          </ui:define>
      </ui:composition>
      </html>
      

       

       

      Working in Windows 7 with:

      --> JBoss Developer Studio 5.0.0.M4

      --> JBoss AS 6.0.0 Final

      --> Seam 2.2.1 Final

      --> BIRT 3.7.0

       

      Hope you can help me.

      Thanks, in advance.