Check if model has data rows with merge syntax?

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I have a tabset, and on one of my tabs I want to change the title based on whether there is data in two of the models.

{{#$Model.Model1.data.length}}Name1{{/$Model.Model1.data.length}} {{#$Model.Model2.data.length}}Name2{{/$Model.Model2.data.length}} History

What I'm trying to say here, is "If Model1 has data rows, display the word "Name1." If Model2 has data rows, display the word "Name2."

If they both have data, I would see Name1 Name2 History.

It's not working. Is there a way to accomplish this?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,674 Points 20k badge 2x thumb
Should work. What do you get now?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Only one of my models has data, but I'm getting both names.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Ah... scratch that. Now it's working. Looks like I didn't give my page time to save in the editor before I refreshed the preview.