• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: core data app questions - help!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: core data app questions - help!


  • Subject: Re: core data app questions - help!
  • From: Ricardo Strausz <email@hidden>
  • Date: Mon, 3 Sep 2007 17:54:00 -0500

Now, this *is* helpful...
I am sure that Jacob will appreciate these words more than any before in this thread...


On Sep 3, 2007, at 4:50 PM, I. Savant wrote:


On Sep 3, 2007, at 1:13 PM, Ricardo Strausz wrote:

First of all, this is "out-of-context"... as mmalc understood (I hope) I refer to the hole replay, not only this last line, but any how...

It really wasn't out of context at all. Unless there are more off- list messages to this thread that I've not seen, anyway.

http://www.google.com/search?hl=en&client=safari&rls=en&q=delegate +methods+table+view&btnG=Search

http://www.google.com/search? hl=en&client=safari&rls=en&q=NSTableView&btnG=Search

IMHO: for me, at least, this is better than nothing...

That's easily debated. Too much indirect, unspecific information is confusing. My gripe was that you essentially sent a picture of a guy swinging a hammer and labeled it "How to Build a House". ;-)


A delegate method does exist for being notified of a change in selection for a table view, but it's still got little to do directly with the original problem. Sending the OP to a list of delegate methods (implementing one of which addresses only a small part of one of his problems) is unhelpful at best.

BTW, Jacob: I'd implement such "sum and average" algorithms in the delegate method tableViewSelectionDidChange: Then your user will be able, also, to drag-select some rows and calculate the sum and average for those selected records.

Okay, I've whined enough and it's time to put my money where my mouth is.


First, this approach is overkill if you're already using bindings. As mmalc alluded, you can use Key Value Coding "Set and Array Operators" to solve this problem via bindings:

http://developer.apple.com/documentation/Cocoa/Conceptual/ KeyValueCoding/Concepts/ArrayOperators.html

This is far easier than responding to a selection change on the table view and running calculations (and manually updating UI) there. How 2004! :-)

  On to the rest ...

1.  I would like to be able to click on a date on the calendar
(currently doesn't have any function) and have only the workout(s)
from that day show in the table.


For the view layer (UI), look up "NSDatePicker". You can configure it to use a visual calendar view or a text field with appropriate spinners.


I'm not sure how exactly you'd want to handle this, but with Core Data, you will need to "ask the right question" when the date is chosen.

  See this document for the use of predicates:

http://developer.apple.com/documentation/Cocoa/Conceptual/ Predicates/index.html

I'm not sure (mmalc?) whether "give me anything on this 'day'" needs to be translated to "give me anything from 00:00:00 on this day to 23:59:59 on this same day" or not, but keep that in mind.

These are the things of which you must be aware, anyhow. If you get stuck, you know where to ask ... ;-)

2.  I would like to be able to click on a sport in the sport table on
in the main window (currently just a listing of the sports that I've
added on the sports window) and have only the workout(s) with that
sport associated with them show in the table.


3. I'd like to have the same functionality with the intensity table in the main window. I'd also like to be able to filter by both sport and intensity, so if I click on a sport and then click on an intensity it shows me only the workouts associated with that sport and intensity.

Again, predicates. You'll probably want to use the selection from your Sport and Intensity array controllers (the same ones to which your table views are bound) to build a compound predicate for your Workout array controller. This will list only "workouts whose sport is { list of included sports } and whose intensity is { list of included intensities }".

The devil, as they say, is in the details (and there are probably more than a few in this setup) but you get the general idea.


4. computations: I'd like to have a text box which shows me the
total of the duration column. If I filter the table by sport or
intensity I'd like this box to show the filtered total. If I can
also show a weekly and monthly total that would be awesome. It would
also be awesome if I could add a column to my workout table that
automatically calculated average pace (workout distance/workout time).



This was answered above, but to reiterate:

http://developer.apple.com/documentation/Cocoa/Conceptual/ KeyValueCoding/Concepts/ArrayOperators.html

It is automatic and pseudo-magical. It's also the easiest and most-immediately-complete solution to this wish-list item.

--
I.S.




_______________________________________________

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


References: 
 >Re: core data app questions - help! (From: Ricardo Strausz <email@hidden>)
 >Re: core data app questions - help! (From: mmalc crawford <email@hidden>)
 >Re: core data app questions - help! (From: Ricardo Strausz <email@hidden>)
 >Re: core data app questions - help! (From: mmalc crawford <email@hidden>)
 >Re: core data app questions - help! (From: Ricardo Strausz <email@hidden>)
 >Re: core data app questions - help! (From: "I. Savant" <email@hidden>)
 >Re: core data app questions - help! (From: Ricardo Strausz <email@hidden>)
 >Re: core data app questions - help! (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: core data app questions - help!
  • Next by Date: Re: How to de-register value observers
  • Previous by thread: Re: core data app questions - help!
  • Next by thread: Re: core data app questions - help!
  • Index(es):
    • Date
    • Thread