How to search for a specific value in core data using magical records? It’s like searching records.
You can do that by
You can either find it by predicate or via a simple value. Suppose I have an entity called FavCPT.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"cptName == %@ && modifier == %@ && dx1 == %@ && dx2 == %@ && dx3 == %@ && dx4 == %@",cptName,modi,dx1,dx2,dx3,dx4];
FavCPT *foundCPT = [FavCPT MR_findFirstWithPredicate:predicate sortedBy:@"cptName" ascending:YES];
Note that the names like cptName, Modifier are the one I have in NSManagedObject Subclass i.e.
FavCPT+CoreDataProperties.h The second way is to simply check the value exist against an attribute. But you can’t check multiple values in this way.
FavCPT *foundCPT = [FavCPT MR_findFirstByAttribute:@"cptName" withValue:cell.DXCodeName.text];