I’m trying to create a sort descriptor, for a core data fetch request, that will fetch objects that are ordered by a calculated value (e.g., the sum of two or more attributes). Is this possible? Thanks in advance.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From the “Core Data Programming Guide”:
So sorting by a calculated value seems not to be possible. You have to pre-calculate the sorting value and store it as (non-transient) attribute in your objects.