$sys.template is required for the dispatch assembler

I’ve created a dispatch template with the following bindings:

$contenttypename=$sys.item.getDefinition().getName()
$sys.template=if ($contenttypename == ‘rx:cicaGenericPage’) { ‘cicaPgGeneric_PF’; } else { ‘cicaPgDecisionSummary_PF’; }
clipboard.id=com.percussion.services.assembly.data.PSTemplateBinding.BINDINGS

So using the content type name it should select the appropriate template. However its giving me the error:

$sys.template is required for the dispatch assembler

I’m fairly new to Rhythmyx and just learning. Any thoughts??

Shane

I suspect the problem is with the syntax you’re using in the binding for $sys.template. I don’t think you can use an if/else construct that way. Instead, you may want to try using the $rx.cond.choose syntax, such as:

$rx.cond.choose ( ($contenttypename == “rx:cicaGenericPage”), “cicaPgGeneric_PF”, “cicaPgDecisionSummary_PF” )

I think that will do what you’re trying to accomplish.

Awsome, that worked. THank you.

Here’s a dispatch template binding for $sys.template that works for me:

if ($sys.item.hasProperty("rx:usage")) {$usage = $sys.item.getProperty("rx:usage").String; } if (! empty($usage) and
$usage == 'S') {'PgAutoNews'; } else if (! empty($usage) and $usage == 'C') {'PgRotatingImageScript'; }  else  {'PgGeneric';  }

On page 418 of the Rhythmyx Implementation Guide 6.5.2, under the section on $rx.cond, it says:

NOTE: This function is deprecated. JEXL expressions that use this binding should be rewritten to use the JEXL if…else conditional function instead.

The reason the $rx.cond.choose is deprecated is that it always evaluates both the true and false expressions.

The if then else that is built into JEXL 1.1 (which was not available before Rhythmyx 6.5) doesn’t have this problem.

As Michael suggests, you need to use a slightly different syntax.

Dave

Thanks for pointing out the note about $rx.cond.choose being deprecated. Since we’re up to using 6.5.2, I’ll make a note that we need to update our bindings to use the if/else syntax.