NickK
1
Is it possible to create a conditional binding parameter so that the binding variable only gets set if the content item has the associated property?
I want to do something like
if ($sys.item.hasProperty(“rx:XXXX”))
$sys.item.getProperty(“XXXX”).String
Nick.
Nick,
Yes, it’s possible. See this thread http://forum.percussion.com/showthread.php?t=508 for an example using a different property. Specifically, see posting #9 for the example code.
RLJII
I’ve just started with Velocity templates and bindings, but I’ve been using something along the lines of:
$rx.cond.choose($sys.item.hasProperty(‘XXXX’),$sys.item.getProperty(‘XXXX’).String,’’)
Your mileage may vary
NickK
4
RLJ,
Can you give an example of how this would work with bindings?
If I enter
if ( $sys.item.hasProperty("rx:XXXXX") )
{ $sys.item.getProperty("rx:XXXXX") ; }
else
{ else ""; }
into the JEXL expression part of the binding I get an error on assembling the item.
dbenua
5
Try this:
if ( $sys.item.hasProperty("rx:XXXXX") )
{ $xyz = $sys.item.getProperty("rx:XXXXX") ; }
else
{ $xyz = ""; }
NickK
6
Thanks.
That works perfectly.