Running user defined Projection problem

Referencing URL :http:///web/index.html#/dashboard

Stream : app-updates

User Defined Projection : MyProjection ( http:///web/index.html#/projections/http%253A%252F%252Feventstore.incred.com%252Fprojection%252FMyProjection )

statusUrl https:///projection/MyProjection

stateUrl https:///projection/MyProjection/state

resultUrl https:///projection/MyProjection/result

On Running attached Query (“http://eventstore.incred.com/web/index.html#/query”) there is no output, The only output seen is “Completed/Stopped/Writing results”.

The Projection is simple, it counts the number of events having some Application id.

Attached screenshots too

“MyProjection” projection also emits events to another stream “my_demo_projection_result”, This stream was created by projection but without any

events.

‘ItemAdded’ for the event handler rather than ItemAdded I think

Hi Steven, Tried with (‘ItemAdded’) and (“ItemAdded”). still no result returned.

Can you browse to the stream and let me see what it looks like?

Steven, PFA for events data.

The even type is “event-type” not ItemAdded, so the handler should subscribe to that.

Thank’s Steven for correction, The issue still persists. The “count” is still zero even after appending events to streams.

Secondly can we print the values of “e” and “s” of “ItemAdded” function using console log.

PFA for new event type and Projection

here is another attachment for new event type.

ItemAdded needs to be in quotes

‘ItemAdded’ : function(s,e)

Hi Steven, Due to limitation of new user, I have to edit this post instead of posting a new one.

I have added another count as suggested, new counter is incrementing but count inside if statement is not incrementing.

Hi Steven, It’s working now. There was issue with event body

Thank’s a lot

1 Like

Can you add another counter in.

So do this:

$init : function(s,e){
return {
count :0, anotherCount :0}
}
},

‘ItemAdded’ : function(s,e){
s.anotherCount++;

//your stuff
}

1 Like