json array as comma separated values into single field

0

Hi have below json 

"markets": [
  {
    "id": "1001",
    "name": "val1"
  },
  {
    "id": "1002",
    "name": "Val2"
  },
  {
    "id": "1003",
    "name": "val3"
  }
]

I wanted to display name field into single text fields with comma separated value. I tried declaring variable as follows

 <variable name="allVall" class="java.lang.String">
            <variableExpression><![CDATA[($V{allVall} != null)?($V{allVall} + $F{name}) :( $F{name})]]></variableExpression>
        </variable>
        
then using the variable in text field as

                <jr:listContents height="20" width="119">
                        <textField isStretchWithOverflow="true" evaluationTime="Report">
                            <reportElement stretchType="ElementGroupHeight" x="0" y="0" width="119" height="20" uuid="35355db6-36be-47f3-b346-ba1f5e5c6919">
                                <property name="com.jaspersoft.layout.grid.weight.fixed" value="false"/>
                                <property name="net.sf.jasperreports.style.box.pen.lineStyle" value="Solid"/>
                            </reportElement>
                            <box>
                                <pen lineWidth="1.0" lineStyle="Solid"/>
                                <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                            </box>
                            <textElement verticalAlignment="Middle">
                                <font fontName="Arial" size="10"/>
                            </textElement>
                            <textFieldExpression><![CDATA[$V{allVall}]]></textFieldExpression>
                        </textField>
                    </jr:listContents>
                    
however still values are displayed as text fields in list component    as multiple text fields. 
I want single text fields with comma separated value. 

can someone pls guide on same. 

Thanks,
Anjana. 

2340patel's picture
Joined: Jan 11 2018 - 8:38pm
Last seen: 2 months 1 week ago

hi anyone come across this need to display in report 

2340patel - 1 year 4 months ago

0 Answers:

No answers yet
Feedback
randomness