Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
MongoDB summing an array
richard.bibb
<p>I have a timeseries documents in a mongodb collection. One of the fields is an array containing 10 values. I want to plot the sum of these 10 values against date.</p>
<p> </p>
<p>Using BIRT under Eclipse (4.6.0) I created a computed column as follows:</p>
<p> </p>
<p>row["return"].reduce(function(a, b) {return a + b;}, 0)</p>
<p> </p>
<p>validation of this calculation works but when I include the computed value in a chart a BIRT exception is generated saying that the reduce method cant be found.</p>
<p> </p>
<p>Does anyone have any ideas about what I'm doing wrong or how I could achieve what I want using another approach?</p>
Find more posts tagged with
Comments
Clement Wong
<p>What data type is "return" defined in the Data Set's Output Column?</p>
<p> </p>
<p>Next, when you go to your Data Set's Edit Data Set dialog, what output do you see when you "Preview Results"?</p>
<p> </p>
<p>I'm guessing that row["return"] isn't an true array and that you'll see an issue in the "Preview Results" too.</p>