When creating a Roll-Up Summary field, is it possible to add filters? (example: only summarize sales amounts for related records when Field A is checked. (field A being a check box field found on the related records) thanks
No, it is not possible.
Hi rocketc,
Roll-Up Summary fields are basically formula field templates which usually return group tokens after you save them.
You can edit the formula thereafter.
e.g.
Object A - Purchase Order
Object B - Line Item
Related Object Summary (Line Items) from Purchase Order.
** Unfiltered Sum
#CALC_SUM.R65140732( sales_amount | true );
//Sum of all Sales amounts from related records
//Change Relationship field to fit your application
** Filtered Sum
#CALC_SUM.R65140732( sales_amount | field_a=1 );
//Sum of all Sales amounts where field A is checked from related records
//Change Relationship field to fit your application
Group tokens use SOQL syntax for filtering on the right hand side and field integration codes to specify which field you want to use which goes on the left hand side.
//Syntax Explanation - related Group Token
#group_token.relationshipcode( field_integration_code | filter );
You can also use the group tokens #CALC_COUNT, #CALC_MAX, and #CALC_MIN to compute values
Add:
//Syntax Explanation - Object Group Token
#group_token.objectname( 1 | true );
//Change the object name for different object summaries.
//Filters and specific fields can also be specified.
#group_token.objectname( field_integration_code | filter );
//You can also add multiple filters on both related and object summaries
#group_token.objectname( field_integration_code | field_a=1 AND field_b=0 AND status='Created');
#group_token.relationshipcode( field_integration_code | field_a=1 AND field_b=0 AND status='Created');
You can also use workflow integration codes as filters (we usually do this to filter out record counts by status).
Thanks.
Martin,
I'm trying to count the # of related records in a child table.....and I want to filter the count....by saying...show me the total number of related records where field_A = ABC123
Field_A is a look-up field (in the child table) and its field_integration_code looks like R65140732
should I use a group token?
#group_token.relationshipcode( field_integration_code | filter );
thanks for any help....
Got it working! Thanks
Martin,
I almost got it...need help
I'm trying to count the # of related records in a child table.....and I want to filter the count....by saying...show me the total number of related records where field_A = ABC123
Field_A is a look-up field (in the child table) and its field_integration_code looks like R65140732
should I use a group token?
#group_token.relationshipcode( field_integration_code | filter );
thanks for any help....