D
D
dezinger2012-12-12 11:05:46
Objective-C
dezinger, 2012-12-12 11:05:46

How to select nested objects with a certain condition using core data?

e12150cff4f22e553436ecf1553992e8.png
I get the country.regions selection with the predicate active = 1 in the debugger, I see the corresponding request with the condition where zactive = 1. But in the next view I get from country.regions and the request appears in the debugger only taking into account the connection. The question is how to specify the active = 1 condition for this nested selection? Do the same for region.items.
I see crooked solutions
1) Specify the predicate already for the selection country.regions i. for NSSet - but this will not affect the request in any way. the filter is already the result of the selection.
2) Make connections manually

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BiFive, 2012-12-12
@BiFive

Country.regions will return all associated regions with the given country. He doesn't care what kind of selection you've got countries.
In my opinion, it is necessary to extend the class by adding a method that returns only active regions (items), something like
- (NSSet*) getActiveRegions;
A, already inside it, select active regions for the current country

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question