StackedBarChart not reading data from a sub-dataset while using JSON data source

0

I am having the following JSON response from the API.

.."result": [
        {
            "taskId": 100004,
            "applicationName": "Retail Bank Portal",
            "taskType": "Gap",
            "featureName": "Bill Pay",
            "release": "5",
            "date": "06:49, Aug 23, 2020",
            "toJira": false,
            "attackControlList": [
                {
                    "status": "COMPLETE",
                    "attack": "manipulate request parameters to view unauthorized resources",
                    "control": "implement indirect object reference to resources (e.g, account statement ID) so only these indirect references are allowed in the client request parameters"
                }]
 
 
..

I am trying to get the applicationName, featureName and taskType from the main JSON and the attack field from the array named as attackControlList. I have two datasets. 1st one is the main dataset of the report which contains the whole JSON as fields and another dataset contains the fields of the array. I am trying to read the attack field from the JSON using the sub dataset but it says that the field not found. Am I doing anything wrong? Here is my jrxml file:

..<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.16.0.final using JasperReports Library version 6.16.0-48579d909b7943b64690c65c71e07e0b80981928  -->
<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="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="84388467-2247-47ee-a188-de42fda5a8bf">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="JasperAPI"/>
    <subDataset name="Dataset1" uuid="718009b5-a78c-4f75-8e8b-e31db9e39322">
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="JasperAPI"/>
        <parameter name="Parameter" class="java.lang.String"/>
        <parameter name="JSON_INPUT_STREAM" class="java.io.InputStream" isForPrompting="false"/>
        <parameter name="net.sf.jasperreports.json.source" class="java.lang.String" isForPrompting="false"/>
        <parameter name="net.sf.jasperreports.json.sources" class="java.util.List" isForPrompting="false"/>
        <parameter name="net.sf.jasperreports.json.date.pattern" class="java.lang.String" isForPrompting="false"/>
        <parameter name="net.sf.jasperreports.json.number.pattern" class="java.lang.String" isForPrompting="false"/>
        <parameter name="JSON_LOCALE" class="java.util.Locale" isForPrompting="false"/>
        <parameter name="net.sf.jasperreports.json.locale.code" class="java.lang.String" isForPrompting="false"/>
        <parameter name="JSON_TIME_ZONE" class="java.util.TimeZone" isForPrompting="false"/>
        <parameter name="net.sf.jasperreports.json.timezone.id" class="java.lang.String" isForPrompting="false"/>
        <queryString language="JSON">
            <![CDATA[result.attackControlList]]>
        </queryString>
        <field name="status" class="java.lang.String">
            <property name="net.sf.jasperreports.json.field.expression" value="status"/>
            <fieldDescription><![CDATA[status]]></fieldDescription>
        </field>
        <field name="attack" class="java.lang.String">
            <property name="net.sf.jasperreports.json.field.expression" value="attack"/>
            <fieldDescription><![CDATA[attack]]></fieldDescription>
        </field>
        <field name="control" class="java.lang.String">
            <property name="net.sf.jasperreports.json.field.expression" value="control"/>
            <fieldDescription><![CDATA[control]]></fieldDescription>
        </field>
    </subDataset>
    <parameter name="JSON_INPUT_STREAM" class="java.io.InputStream" isForPrompting="false"/>
    <parameter name="net.sf.jasperreports.json.source" class="java.lang.String" isForPrompting="false"/>
    <parameter name="net.sf.jasperreports.json.sources" class="java.util.List" isForPrompting="false"/>
    <parameter name="net.sf.jasperreports.json.date.pattern" class="java.lang.String" isForPrompting="false"/>
    <parameter name="net.sf.jasperreports.json.number.pattern" class="java.lang.String" isForPrompting="false"/>
    <parameter name="JSON_LOCALE" class="java.util.Locale" isForPrompting="false"/>
    <parameter name="net.sf.jasperreports.json.locale.code" class="java.lang.String" isForPrompting="false"/>
    <parameter name="JSON_TIME_ZONE" class="java.util.TimeZone" isForPrompting="false"/>
    <parameter name="net.sf.jasperreports.json.timezone.id" class="java.lang.String" isForPrompting="false"/>
    <queryString language="json">
        <![CDATA[result]]>
    </queryString>
    <field name="taskId" class="java.lang.Integer">
        <property name="net.sf.jasperreports.json.field.expression" value="taskId"/>
        <fieldDescription><![CDATA[taskId]]></fieldDescription>
    </field>
    <field name="applicationName" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="applicationName"/>
        <fieldDescription><![CDATA[applicationName]]></fieldDescription>
    </field>
    <field name="taskType" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="taskType"/>
        <fieldDescription><![CDATA[taskType]]></fieldDescription>
    </field>
    <field name="featureName" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="featureName"/>
        <fieldDescription><![CDATA[featureName]]></fieldDescription>
    </field>
    <field name="release" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="release"/>
        <fieldDescription><![CDATA[release]]></fieldDescription>
    </field>
    <field name="date" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="date"/>
        <fieldDescription><![CDATA[date]]></fieldDescription>
    </field>
    <field name="toJira" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="toJira"/>
        <fieldDescription><![CDATA[toJira]]></fieldDescription>
    </field>
    <field name="attackControlList" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="attackControlList"/>
        <fieldDescription><![CDATA[attackControlList]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <summary>
        <band height="220" splitType="Stretch">
            <stackedBarChart>
                <chart evaluationTime="Report">
                    <reportElement x="0" y="0" width="555" height="220" uuid="9620de9c-81d8-4006-b931-aa67dc4cd257"/>
                    <chartTitle/>
                    <chartSubtitle/>
                    <chartLegend/>
                </chart>
                <categoryDataset>
                    <dataset resetType="Report">
                        <datasetRun subDataset="Dataset1" uuid="e11ed00e-3e5b-489d-910d-c5016df04ba6">
                            <datasetParameter name="Parameter">
                                <datasetParameterExpression><![CDATA[$F{attack}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="JSON_INPUT_STREAM">
                                <datasetParameterExpression><![CDATA[$P{JSON_INPUT_STREAM}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="net.sf.jasperreports.json.source">
                                <datasetParameterExpression><![CDATA[$P{net.sf.jasperreports.json.source}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="net.sf.jasperreports.json.sources">
                                <datasetParameterExpression><![CDATA[$P{net.sf.jasperreports.json.sources}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="net.sf.jasperreports.json.date.pattern">
                                <datasetParameterExpression><![CDATA[$P{net.sf.jasperreports.json.date.pattern}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="net.sf.jasperreports.json.number.pattern">
                                <datasetParameterExpression><![CDATA[$P{net.sf.jasperreports.json.number.pattern}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="JSON_LOCALE">
                                <datasetParameterExpression><![CDATA[$P{JSON_LOCALE}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="net.sf.jasperreports.json.locale.code">
                                <datasetParameterExpression><![CDATA[$P{net.sf.jasperreports.json.locale.code}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="JSON_TIME_ZONE">
                                <datasetParameterExpression><![CDATA[$P{JSON_TIME_ZONE}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="net.sf.jasperreports.json.timezone.id">
                                <datasetParameterExpression><![CDATA[$P{net.sf.jasperreports.json.timezone.id}]]></datasetParameterExpression>
                            </datasetParameter>
                        </datasetRun>
                    </dataset>
                    <categorySeries>
                        <seriesExpression><![CDATA[$F{status}]]></seriesExpression>
                        <categoryExpression><![CDATA[$F{attack}]]></categoryExpression>
                        <valueExpression><![CDATA[0]]></valueExpression>
                    </categorySeries>
                </categoryDataset>
                <barPlot>
                    <plot/>
                    <itemLabel/>
                    <categoryAxisFormat>
                        <axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
                    </categoryAxisFormat>
                    <valueAxisFormat>
                        <axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
                    </valueAxisFormat>
                </barPlot>
            </stackedBarChart>
        </band>
    </summary>
</jasperReport>
 
..

jamshaidiqbal120's picture
Joined: Nov 25 2019 - 11:04am
Last seen: 3 days 7 hours ago

0 Answers:

No answers yet
Feedback
randomness