Determining if a specific child table is available for a content item of unknown type

There’s no method that does this easily, but there is a way to inspect all the child tables of a given item and determine if one of them is the one you need. I wrote a macro that you can use to build a list of names of child tables which you can then inspect to see if what you want is available.

## macro to find the names of available child tables in an item
## Sam Rushing, Jan 26, 2011 
#macro(getChildTableNames $item $names)
#set( $names = [] )
#foreach( $childTablePSTypeConfiguration in $parent_item.getDefinition().getDefaultPrimaryType().getChildren() )
#set( $ignored = $names.add($childTablePSTypeConfiguration.getChildField()) )


#getChildTableNames( $sys.item $childTableNames )
#if( $childTableNames.contains("Child1") )
This content item has a child table with a name of "Child1"