Here is the model I have:
http://www.girardet.ch/model.png
My goal is to retrieve all the Quotes with these criterias:
belong to a specific theme : the name_en attribute of Themes
order by relevancy
filtered by Authors (with the alias attribute of Authors)
Here is my code:
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init...
I'm using a SQLite persistent store. I have a NSManagedObject class Den with a to-many relationship Bear. Bear has several fields:
Bear:
breed
color
age
...
When I am building fetch requests for my Foo objects, I can filter to objects that have a related Bear with a certain field value:
NSPredicate *hasGrizzlyPred =...
Hello all, I am currently having an issue pulling all data from db whereby i.e 1 parameter is TRUE.
I am using NSPREDICATE and below is a sample code
NSManagedObjectContext *context = managedObjectContext_;
if (!context) {
// Handle the error.
NSLog(@"ERROR CONTEXT IS NIL");
}
NSEntityDescription *entity = [NSEntityDescriptio...
Say I have core data objects of type "obj" that has a property "propertyA" and a one-to-many relationship with an object of type "sub" that has two properties, "propertyB" and "propertyC".
I want to fetch all the objs that have propertyA equal to a value and a sub obj with propertyB and propertyC set.
If it was just propertyA and pro...
I have an app I am working on that has 2 entities linked by a relationship (many to many). I currently have the app set up so that the rootviewcontroller controls the NSManagedObject (getting, setting, deleting of the data) in the first entity. When I drill down into on of the first entities it goes to a secondview (secondviewcontroller...
I'm having a strange performance issue with core data and compound predicates. I have no problem doing very basic predicates or relatively complex ones, but if I try to create one that is 'somewhere in the middle' (a basic numeric match and an 'or' of a to-many relationship; see the 3rd example below), the app becomes un-responsive and h...
I am writing something in java that will try to "autocomplete" what a user is typing. I have used NSPredicate on iPhone apps to do this. It was very easy and worked well. I am hoping that there is something similar in java, but not having much luck finding it.
If something does not already exist to do this in java, does anyone have...
Given the following Core Data Model:
-> : to-one releationship
->>: to-many relationship
Entity A ->> Entity B
Entity B -> A // each B belongs to exactly one A
Entity B ->> B // a B can be related to other B's
So in class A:
@property (nonatomic, retain) NSSet *Bs;
In class B:
@property (nonatomic, retain) A *A;
@propert...
There appears to be zero documentation about the SUBQUERY keyword from Apple and I can't find a simple explanation about it on SO or on Google. It's a conspiracy! ;)
Please, could someone from the inner-circle please just provide a quick explanation of its syntax so I can use it?
SUBQUERY(Bs, $x, $x IN %@)
Thanks
...
hi i have Core Data database with numerical attributes. they are NSNumbers. Default value is 0.0 but when i try to do some NSPredicated fetch, i get "'NSInvalidArgumentException', reason: 'Invalid predicate: nil RHS'" just because attribute value is 0.0
The predicate is created with:
[NSPredicate predicateWithFormat:@"(startValue => %...
I currently have a 'Topic' entity defined in my system as:
@interface Topic : NSManagedObject
{
}
@property (nonatomic, retain) NSString * path;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSNumber * topicID;
@property (nonatomic, retain) NSNumber * parent;
@end
I want to fetch a topic with a specif...
I have an application which I wrote which used to work perfectly fine. There is new requirement that all data needs to be encrypted now, so I implemented encryption by making all my core data fields type transformable and writing custom transformers for each data type which encrypts/decrypts each element of data as it is written/read fro...
I have a NSFetchedResultsController which displays data in a UITableView. I'm using the boiler plate code provided by Xcode when choosing to create a Core Data project. I added the following predicate to the NSFetchRequest the NSFetchedResultsController uses (before NSFetchedResultsController is initialized):
NSPredicate *predicate = [N...
Hello,
Assume you have an entity called Library and each Library can contain Books. It is possible for a Library to have no books at all. Is it possible to filter a fetch request so I only retrieve the Libraries that contain books?
I have read that you can use the SIZE tag for NSArrays (for example, myArray[SIZE]) in an NSPredicate, bu...
I am presenting table view contents using NSFetchedResultsController which has a predicate:
[NSPredicate predicateWithFormat:@"visible == %@", [NSNumber numberWithBool:YES]]
On background thread using separate NSManagedObjectContext I update few of the entities and change theirs visible value from NO to YES. Save, merge changes in mai...
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"List.name == 'kristof\\'s list'"];
Works as expected.
However I want do something like this:
NSString *listName = [[[detailItem valueForKey:@"name"] description] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"];
NSPredicate *predicate = [NSPredicate predicate...
I need to build an NSPredicate with many pieces of data. For example in SQL I would do something like the following:
SELECT *
FROM TRANSACTIONS
WHERE CATEGORY IN (categoryList)
AND LOCATION IN (locationList)
AND TYPE IN (typeList)
AND NOTE contains[cd] "some text"
AND DATE >= fromDate
AND DATE <+ toDate
I'm st...
I was given a framework written by other programmers to access the core data.
In this situation i receive a pre-loaded NSFetchedResultController which I need to filter, to display a part of it's data.
Here is what I tried:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"category==%@", @"current"];
[NSFetchedResultsControlle...
I have an array of objects (Users)
each user has an nsset named "devices"
Is it possible to filter so the array returns all users who have a device with a specific name.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"devices.category==%@", @"mobile"];
myArray = [allUsersArray filteredArrayUsingPredicate:predicate];
...
I'm finding that a NSFetchRequest is returning different results for a count and for an execute.
I have a Product entity and a Size entity. A Product has many Sizes.
I have two products, productA and productB. ProductA is only available in size1 and productB is available in both size1 and size2.
Given the NSPredicate
'ANY sizes.#siz...