none
How to get running Sum() of latest decimal values inside IObservable<decimal> instances inside another IObservable

    Question

  • I originally asked this question on StackOverflow and got my hand slapped because initially my question did not have enough detail. But I updated the question on StackOverflow, click on that link if you want the detail But here is just the summary.

    I have the following Observable

      IObservable<IObservable<decimal>> runningTotals;

     Now I want a series that gives me the Sum of Latest of all internal observables...

    If it was for only 2 or 3 or 4 up to 17 IObservables, I would do something like this

    var runningGrandTotal  = Observable.CombineLatest(ob1, ob2, ob3 , (a,b,c) => a + b + c);

    but in this case I dont have 3 ob1, ob2 and ob3, I have N number of IObservable<decimal> and they keep on adding or in other words N keeps increasing.... 

    If you wish to see my whole application's source code. Click Here. But if you cannot understand my scenario, I suggest you go to my StackOverflow discussion to get full details.

    Thanks

    fahadash


    Fahad


    • Edited by Fahad349 Sunday, September 15, 2013 12:46 PM
    Sunday, September 15, 2013 12:46 PM

Answers

All replies

  • Hi Fahad,

    Rxx defines an N-ary overload of CombineLatest.  I plan on moving this into Rx, if the Rx team agrees of course.

    Note that it has some special requirements, which are mentioned in the XML comments.  Here's a related discussion about relaxing those requirements.

    - Dave


    http://davesexton.com/blog

    • Marked as answer by Fahad349 Monday, September 16, 2013 8:36 AM
    Sunday, September 15, 2013 4:37 PM
  • Hi Fahad,

    Rxx defines an N-ary overload of CombineLatest.  I plan on moving this into Rx, if the Rx team agrees of course.

    Note that it has some special requirements, which are mentioned in the XML comments.  Here's a related discussion about relaxing those requirements.

    - Dave


    http://davesexton.com/blog

    You got stable binaries of Rxx for me ? Also, is this going to conflict with Rx ?

    Fahad

    Sunday, September 15, 2013 8:32 PM
  • Tried your 4.0 release on my 4.5 system. Got this compile error on the line which was working before

    error CS0012: The type 'System.Reactive.EventPattern`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Reactive, Version=1.0.10621.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

    This is the code at that line

    source.
                    ObserveOnDispatcher(DispatcherPriority.DataBind)
                    .Subscribe(SubscriberMethodName);


    Fahad

    Sunday, September 15, 2013 8:49 PM
  • Hi Fahad,

    Rxx 1.3 targets Rx 1.0, as stated in the Release Notes.

    Rxx 2.0 targets Rx 2.0; however, Rxx 2.0 is not available for download.  You must build Rxx 2.0 from the source code yourself.

    >  Also, is this going to conflict with Rx ?

    No, Rxx is designed to work with Rx as long as you use the correct version.  For example, the Rxx 1.3 NuGet package depends on the Rx 1.0 NuGet package; however, NuGet may automatically download the latest Rx 2.1 package instead, which is not backward compatible; therefore, you must tell NuGet to download the exact version instead, though I haven't tried this myself.

    - Dave


    http://davesexton.com/blog

    Monday, September 16, 2013 5:10 AM
  • Thanks. I had already found it in release notes. Forgot to post here.

    By the way, I am always scared of building my own binaries off the source code. I would only want to do that for research purposes but not for my production releases because I believe binaries provided by the main contributors would have less questionable stability than the ones I build myself.

    Looking forward to your release .


    Fahad

    Monday, September 16, 2013 7:34 AM
  • Dave,

    Alaska State Troopers are grateful to you.

    Image courtesy of AST


    Fahad

    Monday, September 16, 2013 8:45 AM