Author Topic: Predicate based on relationship attribute  (Read 5305 times)

Steve Asson

  • Newbie
  • *
  • Posts: 3
    • View Profile
Predicate based on relationship attribute
« on: March 04, 2013, 09:01:39 PM »
Using chapter 12 as I guide I have set up one table view that lists animal types (fish, turtle, squid etc) and a second table view that then lists specific animals within the selected type (leatherback turtle, green sea turtle, etc).

The problem I am having is getting the second view to properly filter from the database. 

The data structure for the Animals list has a few attributes then a relationship called animalType that links to a second table that has just the types.

When I use a predicate that reads "animalType = 'Fish'" it returns nothing.  When I use a predicate that reads "animalType = '1'" I get the list of fish I expect.

The property on the AnimalTypeEntity object returns the text version, which is as expected.

How do I get the SQLLite ID number that is needed for the filter to work?  When I tried to implement the 'valueForKey:' syntax as shown on the bottom of page 393 I get an error saying "not formatted for key value pair" or something to that effect.

I am using the mmBusinessObject class.

Any help appreciated!

Steve



kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
Re: Predicate based on relationship attribute
« Reply #1 on: March 06, 2013, 05:07:29 PM »
Steve,

Why don't you zip up your project and email it to me and I'll take a look at it:

kevin@iOSAppsForNonProgrammers.com

Kevin