Creating a chart from a MongoDB document List

0

I have MongoDB repository with some fairly complex documents. The gist of the doc is that it has lists of number that I want to create a chart from. For example:

{

  fieldA,

   x:[0,1,2,3,4,5,6...],

   y:[2,4,8,...],

   fieldB

   ...

}

I'd like to chart the x list vs the y list. We're using the AWS variant of the reporting tool and it doesn't support creating topics directly so I'm using iReportDesigner and writing the query with the fields I want back  (x, y) in this example. I then upload the document to AWS Jaspersoft and use that as the topic. When I go to create the chart on the web frontend I get this error below. I have a double whammy n00b scenario as I am newish to both Mongo and Jasper and I'd appreciate any pointers.

Thanks!

--------------------------------------------

The server has encountered an error. Please excuse the inconvenience.

Error Message

java.lang.IllegalArgumentException: unsupported column type java.util.List

Error Trace

java.lang.IllegalArgumentException: unsupported column type java.util.List at com.jaspersoft.commons.datarator.DataColumnFactory.createRawColumn(DataColumnFactory.java:122) at com.jaspersoft.commons.datarator.CategorizedColumn.<init>(CategorizedColumn.java:39) at com.jaspersoft.commons.datarator.SelfOptimizingColumn.<init>(SelfOptimizingColumn.java:25) at com.jaspersoft.commons.datarator.DataColumnFactory.create(DataColumnFactory.java:116) at com.jaspersoft.commons.datarator.ColumnDataSet.addColumnInfo(ColumnDataSet.java:41) at com.jaspersoft.commons.datarator.AbstractDataSet.setColumnInfoList(AbstractDataSet.java:148) at com.jaspersoft.commons.datarator.CachedData.<init>(CachedData.java:73) at com.jaspersoft.commons.datarator.BaseDataSetCacheImpl.getCachedDataSet(BaseDataSetCacheImpl.java:102) at com.jaspersoft.commons.datarator.BaseDataSetCacheImpl.getWorkingDataSet(BaseDataSetCacheImpl.java:136) at com.jaspersoft.commons.semantic.dsimpl.memory.MemoryDataSet.getWorkingDataSet(MemoryDataSet.java:97) at com.jaspersoft.ji.adhoc.strategy.NewClassicDataStrategy.getWorkingDataSet(NewClassicDataStrategy.java:120) at com.jaspersoft.ji.adhoc.strategy.CommonDomainDataStrategy.getWorkingDataSet(CommonDomainDataStrategy.java:1026) at com.jaspersoft.ji.adhoc.InteractiveDataLayoutEngine.initWorkingDataSet(InteractiveDataLayoutEngine.java:350) at com.jaspersoft.ji.adhoc.InteractiveCrosstabBaseEngine$DimensionDataSetInitializer.initDimensionDataSet(InteractiveCrosstabBaseEngine.java:101) at com.jaspersoft.ji.adhoc.InteractiveCrosstabBaseEngine$DimensionDataSetInitializer.init(InteractiveCrosstabBaseEngine.java:81) at com.jaspersoft.ji.adhoc.InteractiveIntelligentChartEngine.generateViewModel(InteractiveIntelligentChartEngine.java:113) at com.jaspersoft.ji.adhoc.action.AdhocAction.setReportModelInContext(AdhocAction.java:1495) at com.jaspersoft.ji.adhoc.action.AdhocAction.view(AdhocAction.java:593) at com.jaspersoft.ji.adhoc.action.AdhocAction.initForTopic(AdhocAction.java:454) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 

.....+ Much more of course

 

 

 

rharrison_1's picture
Joined: Oct 30 2013 - 3:21pm
Last seen: 5 years 7 months ago

Hi,

Does the query works when using iReport.

To work with our MongoDB connector you will need to use our query language, you can find more information here: http://community.jaspersoft.com/wiki/jaspersoft-mongodb-query-language

Thanks,

Assaf

abroitman - 5 years 7 months ago

2 Answers:

0

Hi,

Does the query work when using iReport?

To work with our MongoDB connector you will need to use our query language, you can find more information here: http://community.jaspersoft.com/wiki/jaspersoft-mongodb-query-language

Thanks,

Assaf

abroitman's picture
404
Joined: Aug 19 2013 - 12:25pm
Last seen: 5 years 3 months ago

Thanks Assaf. I dug through a few other documents and read about "unwinding" arrays, so I think I'm good for now. Appreciate your time!

rharrison_1 - 5 years 7 months ago

Hi, I am having converting string to date and integer. In mongodb both date and numbers stored as string. During chart creation, I put date string as X axis and number string as y axis. But ireport is complaining that it can't convert string to date. Anyone know how to convert date string to java.util.Date so that chart can display date as x-axis. Similary how to convert string to integer so taht chart can display y axis with integer value.

mizan_1 - 5 years 4 months ago
0

Circling back on this one, but the ultimate answer is to "unwind" the array. Here's a great reference. 

rharrison_1's picture
Joined: Oct 30 2013 - 3:21pm
Last seen: 5 years 7 months ago
Feedback
randomness