Hi,
I am having trouble with a data structure for an iPhone project. I have an array of Record objects retrieved from an sql database. , each Record hold several strings. On the basis of the value of one of the strings, e.g. 'room', I would like to divide up the array of all the records into new smaller arrays with an array of Records for each unique type of 'room'. I am able to get an array of the unique room types at run time from the sql database with 'select distinct room from myRooms'. I understand how to populate the smaller room specific arrays if I knew the room types in advance, but users can also add new Record objects with custom room types. Is it possible to define an array at run time for each room type, if so how can I do this? Or does anyone have an idea of a different way to accomplish this? I am subdividing the array of all the Record objects so I can present data in a UITableView with a separate section for each type of room.
pseudocode of data structure for three Record objects
name = wrench
date = 3/14/11
room = workroom
name = hammer
date = 3/14/11
room = workroom
name = glass
date = 1/1/11
room = kitchen
then imagine user creates a new record:
name = toy
date = 1/2/11
room = child_room
Thank you in advance for your help.