Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Ternary Sightly Condition is not working


Level 3

Hi Team,

              I have to display the current page title on the basis of checkbox value and in else condition i need to display deafult vale.

I tried  but it is not working it is act as string 

title:${properties.pagetitle ?'currentPage.title':' properties.headline'}

it display me currentPage.title


is there anything wrong in the syntax.

5 Replies


Employee Advisor

Hi @savi50 ,

Yes there is syntax error (Do not use inverted commas inside {}), please use as : 

${properties.pageTitle? currentPage.title : properties.headline}



Level 3

Hi @milind_bachani ,

                      I already tried above but it is giving error 

${properties.pagetitle ?currentPage.title:properties.headline}: mismatched input '}' expecting {'.', 'in', '&&', '||', '[', ':'}


Level 1

Please separate ternary operators with a white-space to provide clarity to the parser. In your case this would be where the colon `:` is used:


${properties.pageTitle ? currentPage.title : properties.headline}

You may also want to confirm your letter-casing and scope (component vs page).


Employee Advisor

Please use proper spacing before and after the operators ( ? : )and then try. 
I also reverified the same on my local it works fine when I use something like :

${properties.prop1 ? properties.prop1 : currentPage.pageTitle}
${properties.prop1?properties.prop1 : currentPage.pageTitle}

But, gives a blank page when I do 

${properties.prop1 ? properties.prop1:currentPage.pageTitle}

Hence, please check the whitespaces.