Note that there are some explanatory texts on larger screens.

plurals
  1. POObjective C, Using the correct part of a plist and looping through to grab data
    text
    copied!<p>another fun (and probably really simple) question for you, that I have half worked out and now run into a dead end...</p> <p>I need to build an indexed table using data from a plist which looks something like this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;Categories&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;CategoryName&lt;/key&gt; &lt;string&gt;Test Category&lt;/string&gt; &lt;key&gt;CategoryID&lt;/key&gt; &lt;integer&gt;10&lt;/integer&gt; &lt;key&gt;Sections&lt;/key&gt; &lt;dict&gt; &lt;key&gt;A&lt;/key&gt; &lt;array&gt; &lt;string&gt;A Jones&lt;/string&gt; &lt;string&gt;A King&lt;/string&gt; &lt;/array&gt; &lt;key&gt;T&lt;/key&gt; &lt;array&gt; &lt;string&gt;T Jones&lt;/string&gt; &lt;string&gt;T King&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;dict&gt; &lt;key&gt;CategoryName&lt;/key&gt; &lt;string&gt;Another Test Category&lt;/string&gt; &lt;key&gt;CategoryID&lt;/key&gt; &lt;integer&gt;20&lt;/integer&gt; &lt;key&gt;Sections&lt;/key&gt; &lt;dict&gt; &lt;key&gt;P&lt;/key&gt; &lt;array&gt; &lt;string&gt;P Jones&lt;/string&gt; &lt;string&gt;P King&lt;/string&gt; &lt;/array&gt; &lt;key&gt;S&lt;/key&gt; &lt;array&gt; &lt;string&gt;S Jones&lt;/string&gt; &lt;string&gt;S King&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;/array&gt; &lt;/dict&gt; </code></pre> <p></p> <p>So, what I need help with is how to get the people in each section depending on the required CategoryID. I think the main problem for me is, how do I determine which CategoryID to pull info out of (ie I know the CategoryID, but how do I relate this to the correct section) and then how do i loop through each section key (a, b, c etc..) when the key is the name of the section (does that make sense?).</p> <p>Any help and thoughts are greatly appreciated! Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload