You need to sign in to do that
Don't have an account?
MrTheTyler
For a report, how do I distinguish records with children from those without children
I have 2 objects on which I want to report: Cases and Surveys. Cases are master objects of surveys. I've created a "Report Type" (Setup>Create>Report Types) which shows all cases with surveys fields even if there is no related survey (ie. a left outer join).
How can I segment my cases into 2 groups: cases with surveys and cases without surveys?
Cheers,
Tyler
Assuming that the relationship is indeed Master-Detail and not just a Lookup, you can use a Rollup Summary Field on the Case object to sum all surveys. You can then use that number directly in a report (i.e. group by Survey Count), or you can create a formula field (Has Surveys (Text) = IF(SurveyCount__c>0,"Yes","No").
All Answers
Assuming that the relationship is indeed Master-Detail and not just a Lookup, you can use a Rollup Summary Field on the Case object to sum all surveys. You can then use that number directly in a report (i.e. group by Survey Count), or you can create a formula field (Has Surveys (Text) = IF(SurveyCount__c>0,"Yes","No").
Thank you! For future reference, how might one accomplish this if it is a lookup relationship as opposed to a master/detail?
For that, you'd have to do your own Rollup Summary trigger. I don't have an example offhand, but basically you'd run a after event trigger (after insert, update, delete, undelete), gather the ID values of all involved records, and run an update on the "parent" records. Then, you'd have a second trigger, on (after update, after undelete) that counts the children for that record.