JSON Datasource - input value is alway null

0

Why is the input value always null? If we manually insert a value (say, 'mike') we get data. Otherwise, empty.

<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="tempjson" 
              pageWidth="842" pageHeight="595" orientation="Landscape" 
              whenNoDataType="AllSectionsNoDetail" 
              columnWidth="802" 
              leftMargin="20" rightMargin ="20" 
              topMargin ="20" bottomMargin="20" 
              uuid="1e755737-89be-4155-ac0f-622514dc7ccc">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
    <property name="ireport.jasperserver.url" value="http://localhost:8081/jasperserver-pro/"/>
    <property name="ireport.jasperserver.user" value="jasperadmin|Reports"/>
    <property name="ireport.jasperserver.reportUnit" value="/public/Blank_mainjr.meb"/>
    <parameter name="term" class="java.lang.String"/>
    <parameter name="net.sf.jasperreports.json.source" class="java.lang.String">
        <defaultValueExpression>
            <![CDATA["https://itunes.apple.com/search?term=" + $P{term}]]>
        </defaultValueExpression>
    </parameter>
    <queryString language="json"><![CDATA[results]]></queryString>

mboyle's picture
3
Joined: Jun 23 2017 - 11:21am
Last seen: 2 years 1 month ago

What is "input value"? How do you run your report?

narcism - 2 years 1 month ago

We are using the JasperReportServer (6.3) and JasperStudio (6.4). Inside of our jasperReport (jrxml) we have defined a parameter ('term'):

<parameter name="term" class="java.lang.String"/>

<parameter name="net.sf.jasperreports.json.source" class="java.lang.String">

<defaultValueExpression><![CDATA["https://itunes.apple.com/search?term=" + $P{term}]]></defaultValueExpression>

 

In the Preview pane, we get a prompt for the 'term' that we want to use in our search. But the value we enter

into the UI is not available when the defaultValueExpression is evaluated. We have no idea why or how to work

around this.

 

Thanks.

mboyle - 2 years 1 month ago

2 Answers:

0

Try setting evaluationTime to 'Early' and isForPrompting to 'false' for the json source parameter. Your JRXML should look like so:

<parameter name="net.sf.jasperreports.json.source" class="java.lang.String" isForPrompting="false" evaluationTime="Early">

<defaultValueExpression><![CDATA["https://itunes.apple.com/search?term=" + $P{term}]]></defaultValueExpression>

</parameter>

narcism's picture
1064
Joined: Nov 22 2010 - 12:39am
Last seen: 41 min 54 sec ago
0

Thanks for the ideas. Alas, they did not work for either the Community Edition nor the official Jaspersoft version. We did learn that modifying the jrxml file outside  of the studio, we were able to modify the file in such a way that we could successfully run using this line.

<parameter name="net.sf.jasperreports.json.source" class="json">

 

Again - thank you for the suggestion. I hope this 'trick' works going forward.

mboyle's picture
3
Joined: Jun 23 2017 - 11:21am
Last seen: 2 years 1 month ago
Feedback
randomness