Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6221549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:09:14+00:00 2026-05-24T08:09:14+00:00

Every time I fetch objects from the database I get all objects. Now, I

  • 0

Every time I fetch objects from the database I get all objects. Now, I have to fetch and show in a table view only some of the objects stored in the database.

To do this, I’ve thought to add a new attribute in my entity, a BOOL attribute so I can fetch only objects that have this attribute’s value equal to YES or NO depending situations.

Is it possible to do something like this?

I’ve found the -setPropertiesToFetch: method of NSFetchRequest class that can be useful but I don’t know if I can use it to see the different value of a BOOL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:09:15+00:00Added an answer on May 24, 2026 at 8:09 am

    It sounds like you just want to use a predicate. The NSPredicate Class Reference gives a good idea of how to use them. Basically, it adds a filter to your results. For example, let’s say you have a core data object with an attribute myBool which is a BOOL (but stored as NSNumber, of course). To filter your results based on that, you would use something like this

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"myBool == %@", [NSNumber numberWithBool:YES]];
    [fetchRequest setPredicate:predicate];
    

    then continue as normal. This will return just the results that have the myBool value as YES.

    That being said, if you are using the request to simply populate a tableView, you might be better off using the NSFetchedResultsController. A great tutorial on how to implement it can be found here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to re-load a table every time some data I get from
Every time I turn on my company-owned development machine, I have to kill 10+
Every time I have to estimate time for a project (or review someone else's
In my activity i am creating a Imageview dynamically. Every time it fetch the
Background I have a calculated value stored in a transient attribute. Every time my
If I were to have a simple tied scalar class that increments every time
I would like to fetch a number of records from a database to fill
I have this function http://jsfiddle.net/wnFsE/ . As you can see every time the user
Every time I create a new project I copy the last project's ant file
Every time I create an object that has a collection property I go back

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.