I have added a static method which can be called from developer console to see the output for reference. public class SK_sortUtilityTestWrapper ...
Pages
Aboutme
Home
Lightning
Integrations
Tips&Trick
InterviewQuestions
Certifications
Monday,April2,2018
SortingWrapperListinASCorDESCorderbasedonWrapperProperty
WegetthesekindofscenariosinwhichwehaveListofwrapperavailableandwanttosortiteitherinASCorDESCorderbasedonanymembervariablewrapperclass.
Supposewehavewrapperclassasmentionedbelow:
publicclassSK_sortUtilityTestWrapper{
publicstringcategory{get;set;}
publicdecimalcount{get;set;}
publicSK_sortUtilityTestWrapper(stringss,decimalsk){
this.category=ss;
this.count=sk;
}
}
Nowimagineifwehavelist andwanttosortlistbasedoncountvaluethenwecandothatbyusingbelowcode.
Ihaveaddedastaticmethodwhichcanbecalledfromdeveloperconsoletoseetheoutputforreference.
Fromdeveloperconsoleexecutebelowscript:
SK_WrapperSortUtility.testWrapperListSorting();
Youwillseebelowoutputindebuglogs:
Hopethiswillhelp!!!!
-
April02,2018
EmailThisBlogThis!SharetoTwitterSharetoFacebookSharetoPinterest
Labels:
Apex,
Tips&Trick
3comments:
AnonymousApril3,2018at7:19AMHiFriend,Weshouldusecomparableinterfaceinsteadofwritingourcustomcodehandlingallthestuffs.Reference:https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_list_sorting_sobject.htmReplyDeleteRepliesReplyMuhammadRafeyJune11,2020at3:50PMThanksfortheblogloadedwithsomanyinformation.StoppingbyyourbloghelpedmetogetwhatIwaslookingfor.foodorderingsystemReplyDeleteRepliesReplyjosDecember28,2020at2:37PMhttps://www.guest-articles.com/education/christmas-55-special-discount-offer-mcia-level-1-exam-28-12-2020ReplyDeleteRepliesReplyAddcommentLoadmore...
NewerPost
OlderPost
Home
Subscribeto:
PostComments(Atom)
SearchThisBlog
LightningComponentsTutorial
FacebookPage:SalesforceArticles
Follow@sunil02kumar
SFDCArchitectCertificationGuide!!
ApplicationArchitect
DataArchitectureandManagementDesigner
SharingandVisibityDesigner
SystemArchitect
IntegrationArchitectureDesigner
IdentityandAccessManagementDesigner
DevelopmentLifecycleandDeploymentDesigner
PopularPosts
CustomPermissions:WaytocontroluseraccesstodifferentfunctionalityinSalesforce
SalesforceInterviewQuestions-Reports&DashboardsPart-2
Howtosetorgetpicklist(dropdown)valuesinLightningComponents
SalesforceInterviewQuestions-Reports&DashboardsPart-1
SalesforceInterviewQuestions-Workflow&ApprovalProcessPart-1
SalesforceInterviewQuestions-ProcessBuilder
SalesforceInterviewQuestions-ValidationRules
GettheContent(Blob)ofFilefromBoxandStore/ManipulateitinSalesforce
FetchAllWorkflowEmailAlertDetailsRelatedtoObjectUsingToolingAPI
CreatingPackage.xmlfromChangesetandRetrievingzipfilecontainingMetadatausingWorkbench
BlogArchive
►
2021
(2)
►
May
(1)
►
March
(1)
►
2020
(8)
►
July
(1)
►
June
(1)
►
April
(3)
►
January
(3)
►
2019
(24)
►
November
(4)
►
September
(3)
►
August
(2)
►
June
(3)
►
May
(3)
►
April
(2)
►
March
(2)
►
February
(4)
►
January
(1)
▼
2018
(43)
►
December
(4)
►
November
(6)
►
October
(3)
►
September
(7)
►
August
(6)
►
July
(4)
►
June
(2)
►
May
(1)
▼
April
(3)
DataArchitectureandManagementDesigner:Things...
ComparableInterface:Waytoperformsortingonw...
SortingWrapperListinASCorDESCorderbasedon...
►
March
(1)
►
February
(2)
►
January
(4)
►
2017
(45)
►
December
(3)
►
November
(2)
►
October
(4)
►
September
(4)
►
August
(4)
►
July
(4)
►
June
(5)
►
May
(3)
►
April
(4)
►
March
(6)
►
February
(3)
►
January
(3)
►
2016
(30)
►
December
(5)
►
November
(1)
►
October
(3)
►
September
(2)
►
August
(1)
►
June
(1)
►
May
(17)
►
2015
(9)
►
June
(2)
►
April
(2)
►
March
(2)
►
February
(1)
►
January
(2)
►
2014
(4)
►
November
(1)
►
September
(2)
►
June
(1)
►
2012
(2)
►
November
(1)
►
October
(1)
Labels
AJAXToolkit
Apex
ApexManagedSharing
ArchitectExamPreparation
Certifications
Chatter
Configurations
DataArchitectandManagementDesigner
DataManagement
Deployments
DynamicApex
Events&Webinars
Exceptions
IdentityandAccessManagementDesigner
IntegrationArchitect
Integrations
InterviewQuestions
LDS
LDV
Lightning
MetadataAPI
OAUTH2.0
OtherBlogs
Presentations
SalesforceRelease
SFDC&BoxIntegration
SharingandSecurity
SharingandVisibility
SystemArchitect
Tips&Trick
ToolingAPI
UtilityTools
Visualforce
ReportAbuse