crosstab in jasper displays only the first column from input json










1














my json is as follows



 "values": [

"purchase":
"name":"bags"
,
"weekSpend": [

"weekStartDate": 20181105,
"spend":100

,

"weekStartDate": 20181112,
"spend":200


]
,

"purchase":
"name":"shoes"
,
"weekSpend": [

"weekStartDate": 20181105,
"spend":100

,

"weekStartDate": 20181112,
"spend":200


]
,
]


I want to displayed the grid where rows are
productname and (columns by weekstartdate)



I followed the technique provided in How to show column at Crosstab even the data is absent



However the productname are listed in row but the column are showing only first column.



my data set is as follows





<queryString language="jsonql">
<![CDATA]>
</queryString>
<field name="productName" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="product.name"/>
<fieldDescription><![CDATA[product.name]]></fieldDescription>
</field>
<field name="weekStartDate" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="weekSpend.weekStartDate"/>
</field>
<group name="activityDateGroup">
<groupExpression><![CDATA[$FweekStartDate]]></groupExpression>
</group>




my crossdata datasource is as follows



 <crosstabDataset isDataPreSorted="true">
<dataset>
<datasetRun subDataset="crossTabDataSet" uuid="e7b27508-8a48-4785-a48e-c646249df9a9">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$PREPORT_DATA_SOURCE).subDataSource("..values(@size > 0).*")]]></dataSourceExpression>
</datasetRun>
</dataset>
</crosstabDataset>


and bucketexpression is on weekstartdate.



With these using JsonQL still only the first column is displayed



How do i get list of column based on weekstardate from iterating from rootnode.



i am using jasper studio 6.5.



Thanks
Anjana.










share|improve this question




























    1














    my json is as follows



     "values": [

    "purchase":
    "name":"bags"
    ,
    "weekSpend": [

    "weekStartDate": 20181105,
    "spend":100

    ,

    "weekStartDate": 20181112,
    "spend":200


    ]
    ,

    "purchase":
    "name":"shoes"
    ,
    "weekSpend": [

    "weekStartDate": 20181105,
    "spend":100

    ,

    "weekStartDate": 20181112,
    "spend":200


    ]
    ,
    ]


    I want to displayed the grid where rows are
    productname and (columns by weekstartdate)



    I followed the technique provided in How to show column at Crosstab even the data is absent



    However the productname are listed in row but the column are showing only first column.



    my data set is as follows





    <queryString language="jsonql">
    <![CDATA]>
    </queryString>
    <field name="productName" class="java.lang.String">
    <property name="net.sf.jasperreports.jsonql.field.expression" value="product.name"/>
    <fieldDescription><![CDATA[product.name]]></fieldDescription>
    </field>
    <field name="weekStartDate" class="java.lang.String">
    <property name="net.sf.jasperreports.jsonql.field.expression" value="weekSpend.weekStartDate"/>
    </field>
    <group name="activityDateGroup">
    <groupExpression><![CDATA[$FweekStartDate]]></groupExpression>
    </group>




    my crossdata datasource is as follows



     <crosstabDataset isDataPreSorted="true">
    <dataset>
    <datasetRun subDataset="crossTabDataSet" uuid="e7b27508-8a48-4785-a48e-c646249df9a9">
    <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$PREPORT_DATA_SOURCE).subDataSource("..values(@size > 0).*")]]></dataSourceExpression>
    </datasetRun>
    </dataset>
    </crosstabDataset>


    and bucketexpression is on weekstartdate.



    With these using JsonQL still only the first column is displayed



    How do i get list of column based on weekstardate from iterating from rootnode.



    i am using jasper studio 6.5.



    Thanks
    Anjana.










    share|improve this question


























      1












      1








      1







      my json is as follows



       "values": [

      "purchase":
      "name":"bags"
      ,
      "weekSpend": [

      "weekStartDate": 20181105,
      "spend":100

      ,

      "weekStartDate": 20181112,
      "spend":200


      ]
      ,

      "purchase":
      "name":"shoes"
      ,
      "weekSpend": [

      "weekStartDate": 20181105,
      "spend":100

      ,

      "weekStartDate": 20181112,
      "spend":200


      ]
      ,
      ]


      I want to displayed the grid where rows are
      productname and (columns by weekstartdate)



      I followed the technique provided in How to show column at Crosstab even the data is absent



      However the productname are listed in row but the column are showing only first column.



      my data set is as follows





      <queryString language="jsonql">
      <![CDATA]>
      </queryString>
      <field name="productName" class="java.lang.String">
      <property name="net.sf.jasperreports.jsonql.field.expression" value="product.name"/>
      <fieldDescription><![CDATA[product.name]]></fieldDescription>
      </field>
      <field name="weekStartDate" class="java.lang.String">
      <property name="net.sf.jasperreports.jsonql.field.expression" value="weekSpend.weekStartDate"/>
      </field>
      <group name="activityDateGroup">
      <groupExpression><![CDATA[$FweekStartDate]]></groupExpression>
      </group>




      my crossdata datasource is as follows



       <crosstabDataset isDataPreSorted="true">
      <dataset>
      <datasetRun subDataset="crossTabDataSet" uuid="e7b27508-8a48-4785-a48e-c646249df9a9">
      <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$PREPORT_DATA_SOURCE).subDataSource("..values(@size > 0).*")]]></dataSourceExpression>
      </datasetRun>
      </dataset>
      </crosstabDataset>


      and bucketexpression is on weekstartdate.



      With these using JsonQL still only the first column is displayed



      How do i get list of column based on weekstardate from iterating from rootnode.



      i am using jasper studio 6.5.



      Thanks
      Anjana.










      share|improve this question















      my json is as follows



       "values": [

      "purchase":
      "name":"bags"
      ,
      "weekSpend": [

      "weekStartDate": 20181105,
      "spend":100

      ,

      "weekStartDate": 20181112,
      "spend":200


      ]
      ,

      "purchase":
      "name":"shoes"
      ,
      "weekSpend": [

      "weekStartDate": 20181105,
      "spend":100

      ,

      "weekStartDate": 20181112,
      "spend":200


      ]
      ,
      ]


      I want to displayed the grid where rows are
      productname and (columns by weekstartdate)



      I followed the technique provided in How to show column at Crosstab even the data is absent



      However the productname are listed in row but the column are showing only first column.



      my data set is as follows





      <queryString language="jsonql">
      <![CDATA]>
      </queryString>
      <field name="productName" class="java.lang.String">
      <property name="net.sf.jasperreports.jsonql.field.expression" value="product.name"/>
      <fieldDescription><![CDATA[product.name]]></fieldDescription>
      </field>
      <field name="weekStartDate" class="java.lang.String">
      <property name="net.sf.jasperreports.jsonql.field.expression" value="weekSpend.weekStartDate"/>
      </field>
      <group name="activityDateGroup">
      <groupExpression><![CDATA[$FweekStartDate]]></groupExpression>
      </group>




      my crossdata datasource is as follows



       <crosstabDataset isDataPreSorted="true">
      <dataset>
      <datasetRun subDataset="crossTabDataSet" uuid="e7b27508-8a48-4785-a48e-c646249df9a9">
      <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$PREPORT_DATA_SOURCE).subDataSource("..values(@size > 0).*")]]></dataSourceExpression>
      </datasetRun>
      </dataset>
      </crosstabDataset>


      and bucketexpression is on weekstartdate.



      With these using JsonQL still only the first column is displayed



      How do i get list of column based on weekstardate from iterating from rootnode.



      i am using jasper studio 6.5.



      Thanks
      Anjana.







      json jasper-reports json-query






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 6:04









      Alex K

      18.4k1479153




      18.4k1479153










      asked Nov 12 '18 at 3:55









      AnjanaAnjana

      297




      297






















          1 Answer
          1






          active

          oldest

          votes


















          0














          There is an invalid field mapping: weekStartDate to java.lang.String, that is not supported in JSONQL.



          Instead you could have this subDataset expression:



          <datasetRun subDataset="crossTabDataSet" uuid="e7b27508-8a48-4785-a48e-c646249df9a9">
          <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$PREPORT_DATA_SOURCE).subDataSource("..values(@size > 0)..weekSpend.*")]]></dataSourceExpression>
          </datasetRun>


          with these field mappings:



          <field name="productName" class="java.lang.String">
          <property name="net.sf.jasperreports.jsonql.field.expression" value="^2.purchase.name"/>
          </field>
          <field name="weekStartDate" class="java.lang.Integer">
          <property name="net.sf.jasperreports.jsonql.field.expression" value="weekStartDate"/>
          </field>





          share|improve this answer




















          • Thanks Narcis, This worked and i am able to get the columns displays
            – Anjana
            Nov 12 '18 at 14:52










          • however encountered another with nested subdataset in crosstab. posted details at stackoverflow.com/questions/53264657/….
            – Anjana
            Nov 12 '18 at 14:53










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255763%2fcrosstab-in-jasper-displays-only-the-first-column-from-input-json%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          There is an invalid field mapping: weekStartDate to java.lang.String, that is not supported in JSONQL.



          Instead you could have this subDataset expression:



          <datasetRun subDataset="crossTabDataSet" uuid="e7b27508-8a48-4785-a48e-c646249df9a9">
          <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$PREPORT_DATA_SOURCE).subDataSource("..values(@size > 0)..weekSpend.*")]]></dataSourceExpression>
          </datasetRun>


          with these field mappings:



          <field name="productName" class="java.lang.String">
          <property name="net.sf.jasperreports.jsonql.field.expression" value="^2.purchase.name"/>
          </field>
          <field name="weekStartDate" class="java.lang.Integer">
          <property name="net.sf.jasperreports.jsonql.field.expression" value="weekStartDate"/>
          </field>





          share|improve this answer




















          • Thanks Narcis, This worked and i am able to get the columns displays
            – Anjana
            Nov 12 '18 at 14:52










          • however encountered another with nested subdataset in crosstab. posted details at stackoverflow.com/questions/53264657/….
            – Anjana
            Nov 12 '18 at 14:53















          0














          There is an invalid field mapping: weekStartDate to java.lang.String, that is not supported in JSONQL.



          Instead you could have this subDataset expression:



          <datasetRun subDataset="crossTabDataSet" uuid="e7b27508-8a48-4785-a48e-c646249df9a9">
          <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$PREPORT_DATA_SOURCE).subDataSource("..values(@size > 0)..weekSpend.*")]]></dataSourceExpression>
          </datasetRun>


          with these field mappings:



          <field name="productName" class="java.lang.String">
          <property name="net.sf.jasperreports.jsonql.field.expression" value="^2.purchase.name"/>
          </field>
          <field name="weekStartDate" class="java.lang.Integer">
          <property name="net.sf.jasperreports.jsonql.field.expression" value="weekStartDate"/>
          </field>





          share|improve this answer




















          • Thanks Narcis, This worked and i am able to get the columns displays
            – Anjana
            Nov 12 '18 at 14:52










          • however encountered another with nested subdataset in crosstab. posted details at stackoverflow.com/questions/53264657/….
            – Anjana
            Nov 12 '18 at 14:53













          0












          0








          0






          There is an invalid field mapping: weekStartDate to java.lang.String, that is not supported in JSONQL.



          Instead you could have this subDataset expression:



          <datasetRun subDataset="crossTabDataSet" uuid="e7b27508-8a48-4785-a48e-c646249df9a9">
          <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$PREPORT_DATA_SOURCE).subDataSource("..values(@size > 0)..weekSpend.*")]]></dataSourceExpression>
          </datasetRun>


          with these field mappings:



          <field name="productName" class="java.lang.String">
          <property name="net.sf.jasperreports.jsonql.field.expression" value="^2.purchase.name"/>
          </field>
          <field name="weekStartDate" class="java.lang.Integer">
          <property name="net.sf.jasperreports.jsonql.field.expression" value="weekStartDate"/>
          </field>





          share|improve this answer












          There is an invalid field mapping: weekStartDate to java.lang.String, that is not supported in JSONQL.



          Instead you could have this subDataset expression:



          <datasetRun subDataset="crossTabDataSet" uuid="e7b27508-8a48-4785-a48e-c646249df9a9">
          <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$PREPORT_DATA_SOURCE).subDataSource("..values(@size > 0)..weekSpend.*")]]></dataSourceExpression>
          </datasetRun>


          with these field mappings:



          <field name="productName" class="java.lang.String">
          <property name="net.sf.jasperreports.jsonql.field.expression" value="^2.purchase.name"/>
          </field>
          <field name="weekStartDate" class="java.lang.Integer">
          <property name="net.sf.jasperreports.jsonql.field.expression" value="weekStartDate"/>
          </field>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 12 '18 at 10:47









          NarcisNarcis

          1,5762617




          1,5762617











          • Thanks Narcis, This worked and i am able to get the columns displays
            – Anjana
            Nov 12 '18 at 14:52










          • however encountered another with nested subdataset in crosstab. posted details at stackoverflow.com/questions/53264657/….
            – Anjana
            Nov 12 '18 at 14:53
















          • Thanks Narcis, This worked and i am able to get the columns displays
            – Anjana
            Nov 12 '18 at 14:52










          • however encountered another with nested subdataset in crosstab. posted details at stackoverflow.com/questions/53264657/….
            – Anjana
            Nov 12 '18 at 14:53















          Thanks Narcis, This worked and i am able to get the columns displays
          – Anjana
          Nov 12 '18 at 14:52




          Thanks Narcis, This worked and i am able to get the columns displays
          – Anjana
          Nov 12 '18 at 14:52












          however encountered another with nested subdataset in crosstab. posted details at stackoverflow.com/questions/53264657/….
          – Anjana
          Nov 12 '18 at 14:53




          however encountered another with nested subdataset in crosstab. posted details at stackoverflow.com/questions/53264657/….
          – Anjana
          Nov 12 '18 at 14:53

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255763%2fcrosstab-in-jasper-displays-only-the-first-column-from-input-json%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo