SugarLogic/Calculated Values:rollupsum for records in related field matching criteria

Idea created by community-support on Oct 29, 2015
    Active
    Score0
    Hello, I am trying to get to grips with calculated fields (though it may be called Sugar Logic! sorry, not sure of my terminology). My calculated field is in the accounts screen and I am trying to run a 'rollupsum' function on a field in related records in the 'products' module - but I only want it do the rollupsum on those related records which meet a certain criteria, namely that a date in the related record is after todays date. The code I'm using is below:

    ifElse(isAfter(related($products,'date_support_expires'),today()),rollupSum($products,'book_value'),0)

    But this code seems to taking only the first record in the related products module, I'm most used to VB looping through records, so I'm making an assumption that the above code is only taking the value in the first record that it finds in the related records. Is anyone able to help to point me in the right direction of how I'd only get it rollupsum'ing on the related records which met the date criteria?

    Any help really gratefully appreciated.

    Many thanks in advance for your help.

    Kind regards

    Julian

    (from juliandavis)