This will reduce both values into one, but I would like to keep these
notions separate.



David Park   Software Developer

M 416*.*461*.*2649

*Points  *|  More together.

Connect with us: Points <http://l.points.com/69s8/> | Twitter
<http://l.points.com/uxlj/> | Blog <http://l.points.com/vu4y/> | LinkedIn
<http://l.points.com/rjs4/> | Careers <http://l.points.com/juqh/>

TSX: PTS <http://l.points.com/sgf7/>; NASDAQ: PCOM
<http://l.points.com/ko1o/>

111 Richmond St W., Suite 700, Toronto, ON, M5H 2G4, Canada

Connect with me: LinkedIn <https://www.linkedin.com/in/butterdave>



On Wed, Jun 13, 2018 at 1:33 PM Aurélien Bénel <[email protected]>
wrote:

> Hi David,
>
> You’ll need a map function:
>
>     function(o) {
>       emit(‘basePoints’, o.basePoints);
>       emit(‘bonusPoints’, o.bonusPoints);
>     }
>
> A reduce function:
>
>     _sum
>
> And you’ll have to call your view with:
>
>     ?group=true
>
>
> Regards,
>
> Aurélien
>
> > Le 13 juin 2018 à 19:13, David Park <[email protected]> a écrit :
> >
> > Say I have a map that emits the following object:
> >
> >>>> {"basePoints": 2000, "bonusPoints": 1000}
> >>>> {"basePoints": 1000, "bonusPoints": 50}
> >>>> {"basePoints": 10000, "bonusPoints": 5000}
> >
> > How could I write a reduce in Erlang that would return an aggregate
> object
> > like this:
> >
> >>>> {"basePoints": 13000, "bonusPoints": 6050}
> >
> > (I would rather not have to write 2 separate views that emit each value
> > separately if i can help it)
> >
> > Thanks!
> >
> > David Park   Software Developer
>
>

Reply via email to