Home
Analytics
mongodb dealing with embedded documents
richard.bibb
<p>I'm using Eclipse BIRT and am having problems understanding how to deal with embedded documents. In my database I have a structure a little like this:</p>
<p> </p>
<p>PORTFOLIO</p>
<p> date</p>
<p> time</p>
<p> name</p>
<p> aum</p>
<p> BASKET</p>
<p> stock</p>
<p> position</p>
<p> price</p>
<p> fx</p>
<p> </p>
<p>So, each portfolio has a basket of stocks. What I want to do is to calculate the net exposure for the portfolio as a % of aum. In mathematical terms this is:</p>
<p> </p>
<p><strong>sum(basket.price*basket.position*basket.fx)/aum</strong></p>
<p> </p>
<p>This should lead to one value per portfolio name</p>
<p> </p>
<p>What I don't know is how do do that roll up when setting up the DataSet. I tried creating a computed column but the numeric values come back as NaN. (see attached screenshot)</p>
<p> </p>
<p>Is anyone able to offer guidance?</p>
Find more posts tagged with
Comments
Clement Wong
<p>What version of Open Source BIRT are you using?</p>
<p> </p>
<p>Can you please attach a sample data set than I can import into my MongoDB to look into this further, and create a possible sample?</p>
richard.bibb
<p>Hi Clement</p>
<p> </p>
<p>I managed to do what I wanted using the Aggregate expression field. That gave me the flexibility of the aggregation pipeline.</p>
<p> </p>
<p>Thanks for responding</p>
richard.bibb
<p>Hi Clement</p>
<p> </p>
<p>If at all possible could you please have a look at my question here:</p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/39595-report-parameters-to-insert-a-list-into-a-mongodb-query/?hl=mongodb'>http://developer.actuate.com/community/forum/index.php?/topic/39595-report-parameters-to-insert-a-list-into-a-mongodb-query/?hl=mongodb</a></p>
;
<p> </p>
<p>I'm stuck due to my lack of knowledge regarding setting and retrieving variables within a report.</p>
<p> </p>
<p>Thank you in advance</p>
<p> </p>
<p>Richard</p>