Concat in Ternary Condition

maynors2427659

01-02-2019

Hi,

   Is there a way to concat a var or a string in a ternary condition as shown below:

<sly>"${ properties.timezoneminute ? ":"  ${properties.timezoneminute} : ":00"</sly>

Off course, this does not work. In the example, I want to show the timezone minutes if there is any chosen otherwise show just 00. EST+18:15, EST+19:00, etc... The "var" I am trying to concat is the Colon (":").

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Gaurav-Behl

MVP

01-02-2019

Try this -

${properties.timezoneminute ? ${properties.timezoneminute} : [ ${properties.timezoneminute}, '00'] @ join=':'}

This is what you would want to use --

1.2.4. Array Join

The join option allows to control the output of an array object by specifying the separator string.

${['one', 'two'] @ join='; '} <!--/* outputs: one; two */-->