# Cannot display values in UI Template

**URL:** <https://discourse.nodered.org/t/cannot-display-values-in-ui-template/84816>\
**Category:** General\
**Created:** [23 January 2024 04:14 UTC](https://discourse.nodered.org/t/cannot-display-values-in-ui-template/84816 "2024-01-23T04:14:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [23 January 2024 04:14 UTC](https://discourse.nodered.org/t/cannot-display-values-in-ui-template/84816/1 "2024-01-23T04:14:32Z")

</div>

This function is retrieving some value from context:

```auto
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:

```auto
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:

```auto
<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:

 ![Screenshot 2024-01-23 at 06.11.36](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/5/f50518ccc67e0e02cb885f3a56750a9d2567dc8d.png)

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

---

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [23 January 2024 04:51 UTC](https://discourse.nodered.org/t/cannot-display-values-in-ui-template/84816/2 "2024-01-23T04:51:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 February 2024 04:52 UTC](https://discourse.nodered.org/t/cannot-display-values-in-ui-template/84816/3 "2024-02-06T04:52:57Z")

</div>

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