Median Salesforce Apex Trigger
Firstly we have to create an object of name “ MPC__c“.

This apex trigger takes two fields
1. Median_Output__c, 2. Values_to_calculate_Median__c.


A median value is the value at the center of a sorted list. To median we need to sort the list in ascending or descending order.
For Example take the list of 3, 5, 2, 7, 3 as our input list. To find out median, first we re-order it as 2, 3, 3, 5, 7. and we find that at location 3 ((5+1)/2) is 3. So the value of median in this list is 3.

Comments
Post a Comment