Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Nested DataObjectSets control

Go to End

2 Posts   1727 Views


Community Member, 5 Posts

8 December 2011 at 6:26pm

Hi all,

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?



Forum Moderator, 1899 Posts

8 December 2011 at 9:01pm

Try Parent instead of Top or this thread may be of interest...