How to store/reference a group of arrays?
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
How to store/reference a group of arrays?
I have a set of folder paths and a set of file names both in drop down menus. When a path is matched with a file the path is searched according to the contents of the file and three arrays are created. What is the best approach for linking this information together? Currently if a new file/path combination is selected the arrays are discarded. If a path file combination is re-selected I'm recreating the arrays from scratch. I think it would be more efficient to store the arrays. I thought of using an associative array with the path and file name as the key but how to link the three arrays to that key? Could I have an object (is that the right term?) array and store the three arrays in the object array and use that as the value for the key? Is there a better approach? Is there a recommended approach for this kind of one to many problem? Thanks
Re: How to store/reference a group of arrays?
If your data is split among three arrays, I imagine it like this:
What I often do is create an array of objects, some people call it a table:
What I often do is create an array of objects, some people call it a table:
Re: How to store/reference a group of arrays?
If your file contents cannot comfortably be in the larger object. Perhaps reference them via key:
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Re: How to store/reference a group of arrays?
Thanks very much for the replies. I think an array of objects is what I need.