I'm currently working on a project where I have a large result set which I am putting into the template. Within this, I would like to control another DataObjectSet but need to retrieve information from its parent DataObject and can't get it to work.
<% control Results %> <% control Brand %> <% control Businesses %> <input type="hidden" title="$Name" link="$Link" deal="$Top.Deal" class="hidden latlng" /> <% end_control %> <% end_control %> <% end_control %>
The problem here is that the "deal" is actually inherited from Brand, but $Top returns the DataObjectSet from Results. Is there a simple way to grab only the immediately preceding DataObject and then be able to get information from it?
I need to be able to loop through all "Businesses" for each "Brand" and breaking that control early to be able to access the "Deal" text obviously breaks this loop.
Is the easiest option just to write a function in the controller which returns the correct values for me, or is there a way to do it in the templates?