CA Service Management

 View Only
Expand all | Collapse all

CA SDM 17 & Jasper 6.4.3 - simple report with paramater - SQL error

  • 1.  CA SDM 17 & Jasper 6.4.3 - simple report with paramater - SQL error

    Posted Jul 19, 2019 09:41 AM
    CA SDM 17 & Jasper 6.4.3 - simple report with paramater

    I tried to created a simple report (main jrxml) using Tibco jaspersoft studio with following query and Parameter

    <parameter name="MyParam" class="java.lang.String"/>
     <queryString>
      <![CDATA[SELECT
    cr.ref_num as cr_ref_num,
    cr.summary as cr_summary, 
    ...
    FROM cr
    WHERE cr.ref_num = '401359']]>
     </queryString>

    It works fine.

    But if try to use the MyParam parameter in the where clausule bellow, i got an error: net.sf.jasperreports.engine.JRException: Error executing SQL statment for: RAW_TICKET.
    I still do not see what is wrong...

    <parameter name="MyParam" class="java.lang.String"/>
     <queryString>
      <![CDATA[SELECT
    cr.ref_num as cr_ref_num,
    cr.summary as cr_summary, 
    ...
    FROM cr
    WHERE cr.ref_num = $P{MyParam}]]>
     </queryString>



    ------------------------------
    Radek Mihalik
    ------------------------------


  • 2.  RE: CA SDM 17 & Jasper 6.4.3 - simple report with paramater - SQL error
    Best Answer

    Posted Jul 22, 2019 04:59 AM
    it seems I have to use the exclamation sign...
    it works now in this way

    MyParam = '123456' (quotas must be used in param string) 

    FROM cr
    WHERE cr.ref_num = $P!{MyParam}]]>
     </queryString>

    OR this way

    MyParam = 123456 (without quotas in param string) 

    FROM cr
    WHERE cr.ref_num = '$P!{MyParam}']]>
     </queryString>

    ------------------------------
    Radek Mihalik
    CZ
    ------------------------------