Check if model has data rows with merge syntax?

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.

{{#$}}Name1{{/$}} {{#$}}Name2{{/$}} 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?

Should work. What do you get now?

Only one of my models has data, but I’m getting both names.

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.