Re: CoreData issue
Re: CoreData issue
- Subject: Re: CoreData issue
- From: Andrew Merenbach <email@hidden>
- Date: Thu, 7 Sep 2006 11:49:50 -0700
Hi, Patrick.
I was slightly off, now that I've done a little more research.
Should've waited to open my big mouth.
NSSets are employed in certain aspects of Core Data for to-many
relationships, if I understand correctly. Unordered NSArrays are
employed (if others are correct and I understand correctly) by
NSArrayController, for performance and ease-of-programming reasons.
You'll still need an NSSortDescriptor to sort your data, though--the
effect is the same. Someone else posted a link to an interesting
explanation for why maintenance of order was not implemented in Core
Data 1.0.
Sorry for the slight misinformation.
Cheers,
Andrew
On 7 Sep 2006, at 05:13, Patrick Perroud wrote:
On 6 Sep 2006, at 19:04 , Andrew Merenbach wrote:
Hi, Patrick.
Core Data employs NSSets, rather than NSArrays, to store the
contents of NSArrayControllers. This is why you will need
NSSortDescriptors to sort your data. I suggest checking out the
docs for those, which will come in very handy for your purposes.
(Without them your data will just be returned in an essentially-
arbitrary order.)
Hope this helps,
Andrew
>
Thank you Andrew for your interesting answer, but I'm not so sure I
could follow you in here.
In short - my example was not so good since it was giving you the
impression that my list was sorted in the first place, but it was not.
So I don't see how setting an ascending or descending sorting key
would solve this issue: I just need to fetch the oiginal data in
its original unsorted order.
And adding a sorting key would only increase the confusion to me.
I mean: 3 rows reading 321, 123 and 231 are not sorted - if they
were written/read sorted ascendingly then the new sorted order
would read 123, 231 and 321, which is different from the original
order obviously.
In conclusion, if CoreData was not saving NSArrays in their stack
order but randomly then this would be a serious misconception, to me.
The funny part is that Apple's tutorial at http://
developer.apple.com/cocoa/coredatatutorial/index.html is just doing
this and it works just fine with them: I just don't know how they
could get it sorted in its original order in their tutorial movie...
Best regards
Patrick Perroud
On 6 Sep 2006, at 09:49, Patrick Perroud wrote:
Hello,
I'm quite new to CoreData and keen to grasp it in depth.
Testing it around from a while I came thu a strange issue I was
not able to solve by myself so far.
In short - I have 2 bound listboxes within a document window:
getting 3 rows in list 1 that reads "1.0", "2.0" and "3.0".
When first row is selected - I get 3 rows in list 2 that reads
"MSG 1", "MSG 2" and "MSG 3".
All UI - etc - is working fine.
But when I save it to binary file - then re-open the saved data,
list 1 reads "3.0", "1.0" and "2.0".
And selecting the 2nd row (that now reads "1.0"), list2 rows now
reads "MSG 2", "MSG 1" and "MSG 3".
IOW - it doesn't fetch back the 2 lists data in same order.
I have checked carefully my bindings and didn't find nothing that
would explain such an error, so I must be missing something
important in here.
Any comment and advice about such an issue would be very much
welcomed indeed.
Best regards
Patrick Perroud
- - - - - - - - -
http://p.perroud.free.fr/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40ucla.edu
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden