none
Summing up a child collection. RRS feed

  • Question

  • Hi,

    I am trying to sum a collection of Fee instances inside an object and am struggling.
    I have a list of Fee instances FeeCollection : List<Fee> {}
    Each Fee has an Amount attribute, and the FeeCollection is a property of a Portfolio object.

    =Sum(Fields!Portfolio.Value.Fees(0).Amount) Gives me the value of the first item in the collection.

    How do I sum the collection?

    =Sum(Fields!Portfolio.Value.Fees.Amount) Gives the error that Amount is not a property of FeeCollection.
    =Sum(Fields!Portfolio.Value.Fees.Value.Amount) Gives the error that Value is not a property of FeeCollection.

    I am sure I must be specifying it incorrectly somehow.
    I have exhausted all the combinations I can dream up, and the documentation is really not great.

    Please help
    Regards
    Craig.

    Wednesday, July 23, 2008 1:40 PM

All replies

  • Hi Craig,

    I'm a little confused, where is this fee field coming from.  If it's coming from a subreport, look into shared variables.  If it's coming from a detail in the report, look into grouping totals.  Summing by hand is not very often used, crystal iterates to the smallest denominator of the data, and that's how it most often will handle to totaling.

    Hope that helps,

    John.
    Visit my web site at: http://RadiolistenersElectricEasel.com/ If a post is helpful please give it a vote of helpful
    Saturday, August 2, 2008 12:01 PM