Core Data dynamic attributes and fetching
Core Data dynamic attributes and fetching
- Subject: Core Data dynamic attributes and fetching
- From: Ben <email@hidden>
- Date: Sat, 24 May 2008 08:36:15 +0100
Hi all,
I have a core data object graph using an SQLite store where several
entities have an attribute containing a date (eg, birthDate). This is
stored as a date type.
I am currently implementing an NSPredicateEditor for building smart
groups. Each smart group simply saves this predicate to an attribute
and then fetches using that.
The problem is that I want to offer to filter by ('days since birth'
== 7), as well as (birthDate == 01/01/01). This is where I have hit a
wall. I can't set a dynamic transient property for daysSinceBirth as
these can't be used in fetch requests, and I can't convert the number
of days to an absolute date as this loses the dynamic-calculation part
of the number. I did think of using a transformable attribute to
convert a second date field to an int, but then apparently this can't
be used in a fetch request either.
I suppose that I could use a placeholder segment of predicate which is
replaced when used, but this seems a bit awkward and inelegant.
Does anyone have any suggestions on how I could achieve this?
Regards,
Ben
_______________________________________________
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