Skip to main content

Search

Support for aggregations in the CAML query builder

Comments

1 comment

  • Jonathan Cardy

    As a workaround - and for anyone else viewing this - I am doing the SUM calculation as follows:

     

    let invoiceAmounts = [[@Functions.GetValuesForQuery('Lists/Invoices', '<View>
        <Query>
        
        <Where>
    ...
        </Where>
        </Query>
        <ViewFields>
            <FieldRef Name="InvoiceAmount" />
        </ViewFields>
        <RowLimit Paged="TRUE">20</RowLimit>
    </View >', 'InvoiceAmount')]];

    const sum = invoiceAmounts.reduce((partialSum, a) => partialSum + a, 0);
    return sum;
    1

Please sign in to leave a comment.