Child Tables and Init Slots

Is there a way to access child tables inside of init slots? I can’t seem to do it.

Ann,

Child tables and Slot are different constructs. Slot macros (#slot, #node_slot, etc… and including #initslot) all display Slot relationships which are different Content Items related to the item being assembled. Child Tables are a one-many relationship on the current item, so they are not accessed by any of the Slot macros. There is a #children macro which is used to access this data.

#macro(children $childname $templatename $header $before $after $footer)##
#set($childresults = $rx.asmhelper.assembleChildren($sys.assemblyItem,$sys.item,$childname,$templatename))##
#if($childresults.size() > 0)##
$header##
#foreach( $child in $childresults )##
$before##
$rx.doc.extractBody($child)##
$after##
#end##
$footer##
#end##
#end

Using the code within this macro would be the rough equivalent of using an “extracted” #initslot.

Hope this helps and let me know if you are actually trying to do something differently.

M.

I was actually able to do what I wanted with my original code. I just made the mistake of not passing my template to the slot beforehand. Even if you aren’t going to use that template, you need to make sure that your slot gets a template. I wasn’t getting an error, so I thought it wasn’t possible to do this. But thank you for the code. I hope that it will help someone out who might need to do this.