Query core data store based on a transient calculated value
Query core data store based on a transient calculated value
- Subject: Query core data store based on a transient calculated value
- From: Darren Wheatley <email@hidden>
- Date: Wed, 26 Oct 2011 22:17:16 +0100
- Thread-topic: Query core data store based on a transient calculated value
Hi,
I'm fairly new to the more complex parts of Core Data.
My application has a core data store with 15K rows. There is a single
entity.
I need to display a subset of those rows in a table view filtered on a
calculated search criteria, and for each row displayed add a value that I
calculate in real time but don't store in the entity.
The calculation needs to use a couple of values supplied by the user.
A hypothetical example:
Entity: contains fields "id", "first", and "second"
User inputs: 10 and 20
Search Criteria: only display records where the entity field "id" is a prime
number between the two supplied numbers. (I need to build some sort of
complex predicate method here I assume?)
Display: all fields of all records that meet the criteria, along with a
derived field (not in the the core data entity) that is the sum of the "id"
field and a random number, so each row in the tableview would contain 4
fields:
"id", "first", "second", -calculated value-
>From my reading / Googling it seems that a transient property might be the
way to go, but I can't work out how to do this given that the search
criteria and the resultant property need to calculate based on user input.
Could anyone give me any pointers that will help me implement this code? I'm
pretty lost right now, and the examples I can find in books etc. don't match
my particular needs well enough for me to adapt them as far as I can tell.
Thanks
Darren.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden