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

  • Home
  • SEARCH
  • 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 744127
In Process

The Archive Base Latest Questions

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

I have an array I load with lots of data from an xml file.

  • 0

I have an array I load with lots of data from an xml file. I am displaying this on a tableview and then when you click on say an author it goes through to display all their books.

At the minute my NSMutableArray has an entry for every each book with title, author and so on. So in the table of authors it display the authors name as many times as they have books. I want to group the array data so the table only displays each author once but the author contains an array of his books. Seems simple but I can’t find a group method for arrays.

  • 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-14T08:56:33+00:00Added an answer on May 14, 2026 at 8:56 am

    You can loop through the books array and create a new array for the authors. For each book, check if that author is already in the authors array using containsObject. But then you’d also have to worry about only showing that author’s books from the books array when the user selects an author.

    It’s probably better to load the xml file into an NSMutableDictionary in the first place instead where the keys are the author names and the object for each key is an NSMutableArray of that author’s books.

    Then the author tableview would use the dictionary’s keys as the data source (using array returned by allKeys which you can then sort if needed or use keysSortedByValueUsingSelector) and the books tableview would use the book array of the selected key.

    If the data becomes too large to load into memory all at once, then you’ll have to use other options such as SQLite.

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

Sidebar

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.