Cannot display values in UI Template

This function is retrieving some value from context:

let data = {
    totalZeroHoursYear: flow.get("totalZeroHoursYear") || "N/A",
    totalZeroHoursMonth: flow.get("totalZeroHoursMonth") || "N/A",
    totalZeroHoursWeek: flow.get("totalZeroHoursWeek") || "N/A",
    totalZeroHoursYesterday: flow.get("totalZeroHoursYesterday") || "N/A",
    totalZeroHoursToday: flow.get("totalZeroHoursToday") || "N/A"
};
msg.payload = data;
return msg;

The output is an object:

23/01/2024, 05:47:32node: debug 316
msg.payload : Object
object
totalZeroHoursYear: "42.39"
totalZeroHoursMonth: "42.39"
totalZeroHoursWeek: "0.96"
totalZeroHoursYesterday: "0.96"
totalZeroHoursToday: "0.00"

A template node is connected to the output of the above function:

<div style="text-align: left; font-size: 18px; margin-top: 10px;">
    <p><b>Power Outage Duration:</b></p>
    <p>Year: {{payload.totalZeroHoursYear}} hours</p>
    <p>Month: {{payload.totalZeroHoursMonth}} hours</p>
    <p>Week: {{payload.totalZeroHoursWeek}} hours</p>
    <p>Yesterday: {{payload.totalZeroHoursYesterday}} hours</p>
    <p>Today: {{payload.totalZeroHoursToday}} hours</p>
</div>

It looks all correct to me but I cannot display the values on the UI:

The value shows up if I use a text node instead of a template with value set as {{msg.payload.totalZeroHoursYear}} hours etc.

I would appreciate som help to get this working in the template node. Thank you

I found the issue.
this:

Year: {{payload.totalZeroHoursYear}} hours

should be like this:

Year: {{msg.payload.totalZeroHoursYear}} hours

Just in case someone has a similar issue.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.