Dataview Settings - Handlebars code question #compare

Hello,

I had this handlebar code in the data view settings of my directory app.I am needing to make a change because there are three different values that need to be compared against. I am wondering if there is a way for me to still do this with handlebars in the data view settings. I tried to ask in the chatAI tool but I got the answer that this wasn’t possible because handlebars has no native else if support. I am just wondering if maybe I didn’t ask the question correctly or if there is a better way to do this.

Original Code I was using:
{{#compare [UKGBadge] ‘===’ ‘Yes’}}

UKG Trained Manager
{{else}} {{/compare}}


{{#if (UKGbadge === 10year)}}

This is div for A
{{else}} {{#if (UKGbadge === 5year}}
This is div for B
{{else}} {{#if (UKGbadge === 3year}}
This is div for B
{{else}} {{/if}} {{/if}} {{/if}}

Hi Catalina,

You can add a comparison expression after the other. Something like:

{{#compare [UKGBadge] '===' '10year'}}
  This is div A
{{/compare}}
{{#compare [UKGBadge] '===' '5year'}}
  This is div B
{{/compare}}
{{#compare [UKGBadge] '===' '3year'}}
  This is div C
{{/compare}}

Since you are checking the value of the same variable UKGBadge, you don’t need to nest them, as UKGBadge will only have one value at a time.