Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Super Macho Man

macrumors 6502a
Original poster
Jul 24, 2006
505
0
Hollywood, CA
I'm working on a Core Data app, following the examples I'm seeing on the web. This is my last major stumbling block to a successful working application...

I have an NSArrayController called Fish that contains a bunch of different fish. And I have another NSArrayController called Aquarium that contains a bunch of different aquariums.

I want to be able to specify in which aquarium a particular fish lives. I want to do this by having a list of all my aquariums in the right column of an NSTableView, and NSButtonCells (checkboxes) in the left column. So when I click on a particular fish in NSTableView #1, I can see which aquarium is checked in NSTableView #2. See my post further down for a visual example.

My xcdatamodel currently looks like: Fish <---->> Aquariums.

P.S. Is there a way to do this exclusively in Interface Builder? :eek:

Or is there a better way to do this altogether?

Edit: I will send $40 via Paypal to the first person who can walk me through this and help me get it working. The image below is what I'm talking about. I want to make which items are checked in Table 2 depend on the selection in Table 1, but the contents of Table 2 (aside from the checkboxes) should be the same as Table 3. I have been going by the tutorial on this page: http://www.cocoadevcentral.com/articles/000085.php

PM me!

Edit: Bounty increased to $40.
 

aquanutz

macrumors regular
Dang it! If I had a mac with me right now I'd definately be able to help you. I'm stuck in Boston right now at my girl friends place and won't be back on my mac with all my code until next monday. If no one can help you by then (which I doubt, the guys on here are great) I'll see what I can come up with.
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
As long as you set all of them up, then yes. So for example:
I add a Media (not sure if you mean DVD, CD, VHS, etc.) so I click VHS, and I add all the titles and the ones that are selected (checked) store an isTypeOfMedia or that bool value, now do you want it to show both selected and non or just selected
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
Does this help?
When I select my class, it shows assignments in those classes and loads that data. In the assignments controller the content set is the Classes Controller's classAssignments which is a relationship to Assignments which has an inverse relationship to theClass which is a relationship in Assignments.

Anyways, I gave you 3 screenshots to try and help you out, anything that is set will be shown depending on what you select. If you need the source to my ADM program, just let me know.

EDIT: OK HERE'S AN UPDATE:
When I made a 4th column and linked that column to my isCompleted BOOL flag, it saved, it knew if it were checked to save it and make sure that the flag for it was saved, so yes, how I stated above, will work.

EDIT 2: You can also add a search bar and make a predicate to be if the value is set so they can search for what is just set in the one column.
 

Attachments

  • Picture 1.png
    Picture 1.png
    65.1 KB · Views: 103
  • Picture 3.png
    Picture 3.png
    103.7 KB · Views: 133
  • Picture 4.png
    Picture 4.png
    55.4 KB · Views: 102

Super Macho Man

macrumors 6502a
Original poster
Jul 24, 2006
505
0
Hollywood, CA
slooksterPSV said:
Does this help?
I think I get what you're saying, but I'm not sure if it quite matches what I want to do. I want my Table 2 to be a complete list of all media - in other words its contents should match what are in Table 3. When I change the selection in Table 1, the Call # column in Table 2 should stay the same - the only thing that should change is which boxes are checked.

In other words, by clicking on something in Table 1, I'm not narrowing down the list in Table 2. Table 2 is like a restaurant menu and the entries in Table 1 are like customers - each customer is ordering something different, but the menu is the same for everybody. (If that makes any sense :) )

I can bind a table column to Media Call # and another to mediaIsChecked and the checkboxes will work, but not depending on which footage is selected. Likewise I could make a footageIsChecked BOOL but then I don't know how to associate that with anything in my Media entity.
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
Super Macho Man said:
I think I get what you're saying, but I'm not sure if it quite matches what I want to do. I want my Table 2 to be a complete list of all media - in other words its contents should match what are in Table 3. When I change the selection in Table 1, the Call # column in Table 2 should stay the same - the only thing that should change is which boxes are checked.

In other words, by clicking on something in Table 1, I'm not narrowing down the list in Table 2. Table 2 is like a restaurant menu and the entries in Table 1 are like customers - each customer is ordering something different, but the menu is the same for everybody. (If that makes any sense :) )

I can bind a table column to Media Call # and another to mediaIsChecked and the checkboxes will work, but not depending on which footage is selected. Likewise I could make a footageIsChecked BOOL but then I don't know how to associate that with anything in my Media entity.
And there's the part I missed. You don't want to have to enter all the data into each of the media's. So let me try something then I'll post with my results.
 

Super Macho Man

macrumors 6502a
Original poster
Jul 24, 2006
505
0
Hollywood, CA
This is just an update of what I'm trying to accomplish, it's basically the same as above but with a 4th table (the "inverse" of Table 2) and it deals with fish and aquariums just to make the relationship clearer (fish <<--> aquariums).

Edit: Whoops I screwed up one of the screenshots, here are the new ones.
 

Attachments

  • xcdatamodel.jpg
    xcdatamodel.jpg
    12.6 KB · Views: 106
  • example2.jpg
    example2.jpg
    68.4 KB · Views: 110

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
Sorry I don't know how to do it like that. Objective-C would be easier, CoreData, I'm not sure how you'd do that.

With objective C you could store arrays and arrays of stuff.
E.g. Aquariums->List of Fish->Selected Aquarium->Fish Check fish in aquarium
So you'd have to have a list of aquariums, if the aquarium is selcted, then an array in that aquarium would be of the fish, and those fish would be an object of name and ischecked. So
Aquariums->Fish->Name, isChecked
Array->Array->Object

Fish->Aquarium->Name, isChecked
Array->Array->Object
 

Super Macho Man

macrumors 6502a
Original poster
Jul 24, 2006
505
0
Hollywood, CA
slooksterPSV said:
Sorry I don't know how to do it like that. Objective-C would be easier, CoreData, I'm not sure how you'd do that.

With objective C you could store arrays and arrays of stuff.
E.g. Aquariums->List of Fish->Selected Aquarium->Fish Check fish in aquarium
So you'd have to have a list of aquariums, if the aquarium is selcted, then an array in that aquarium would be of the fish, and those fish would be an object of name and ischecked. So
Aquariums->Fish->Name, isChecked
Array->Array->Object

Fish->Aquarium->Name, isChecked
Array->Array->Object
:) Thanks for trying to help at least :) This is turning out to be a harder problem than I thought it would be. But I'd really like to get it done with bindings/Core Data.

aquanutz said:
Dang it! If I had a mac with me right now I'd definately be able to help you. I'm stuck in Boston right now at my girl friends place and won't be back on my mac with all my code until next monday. If no one can help you by then (which I doubt, the guys on here are great) I'll see what I can come up with.
Great! Looking forward to it :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.