title: Grails using a get within a g:each
body: <p>I'll acknowledge right off that the title is probably not the right reference here so please let me know if I'm using the wrong phrase and I'll correct!</p>
  
  <p>Overview - I have an Form.gsp and corresponding _form.gsp, into which I feed a load of values from an SQL query, which includes the ID from another controller (called Object, multiple object being linked to a form).</p>
  
  <p>During the construction of the table which lists all these objects I need to take the object id and then get it to go off to the Object controller, use the ID to return the objects name and populate the text box with that value.  But I can't work out how to do this, here's what I've tried (cutting out the rubbish of course).</p>
  
  <p>The Objects ID is called object_id and the g:each var is item.  So I've tried to insert it my Object.get(x) as: -</p>
  
  <pre><code>value = "${Object.get(item.object_id)}"
  </code></pre>
  
  <p>But this give the error <code>No signature of method: static java.lang.Object.get() is applicable for argument types: (java.math.BigDecimal) values: [4]</code> </p>
  
  <p>Incidentally the ID value is 4 that I need to look for...</p>
  
  <p>I've also tried </p>
  
  <pre><code>value = "${Object.get(${item.object_id})}"
  </code></pre>
  
  <p>But I get an <code>Unclosed GSP expression</code> error.</p>
  
  <p>This is within my _form.gsp</p>
  
  <pre><code>&lt;table id="eventList"&gt;
          &lt;g:each in="${results}" status = "i" var="item"&gt;
              &lt;tr&gt;
                  &lt;td colspan="3"&gt;
                      &lt;table id = "sub"&gt;
                          &lt;tr&gt;
                              &lt;td&gt;&lt;b&gt;Object&lt;/b&gt;&lt;/td&gt;&lt;td&gt;
                              &lt;g:select style="width:550px;"id="objectID[$i]" name="objectID[$i].id" from="${framework.Object.list(sort:"objDesc")}" optionKey="id" required="" value="${item.object_id}" class="many-to-one"/&gt;
  
                              &lt;richui:autoComplete name="objectID[$i].id" value = "${Object.get(item.object_id)}" action="${createLinkTo('dir': 'object/searchAJAX')}"    /&gt;
  
                              &lt;/td&gt;
  
                          &lt;/tr&gt;
                      &lt;/table&gt;                                
                  &lt;/td&gt;       
              &lt;/tr&gt;
          &lt;/g:each&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>Also worth noting that I do just want it to return and display the objDesc value not the whole entry and am not sure how I tell it to basically say "give me back the objDesc where the ID = item.object_ID.</p>
  
  <p>Thanks for any help!</p>