# Help with what I am seeing going through \`template\` node

**URL:** <https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760>\
**Category:** General\
**Created:** [27 July 2020 08:41 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760 "2020-07-27T08:41:08Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 08:41 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/1 "2020-07-27T08:41:08Z")

</div>

( **NOT** the GUI one)

This is the code:

```auto
[{"id":"46f61a5c.0b4104","type":"inject","z":"280a6f57.28406","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":700,"wires":[["8cac52a0.8785c"]]},{"id":"8cac52a0.8785c","type":"moment","z":"280a6f57.28406","name":"","topic":"","input":"","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"DD/MM/YY","locale":"en_AU","output":"","outputType":"msg","outTz":"Australia/Sydney","x":330,"y":700,"wires":[["660ee550.29552c"]]},{"id":"660ee550.29552c","type":"change","z":"280a6f57.28406","name":"Position","rules":[{"t":"set","p":"x","pt":"msg","to":"x","tot":"flow"},{"t":"set","p":"y","pt":"msg","to":"2","tot":"num"},{"t":"set","p":"separator","pt":"msg","to":"separator","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":120,"y":790,"wires":[["6917a797.4f08a8"]]},{"id":"6917a797.4f08a8","type":"string","z":"280a6f57.28406","name":"","methods":[],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":310,"y":790,"wires":[["f68e0e37.99ddf","2f55bb51.91bc84"]]},{"id":"f68e0e37.99ddf","type":"debug","z":"280a6f57.28406","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":420,"y":840,"wires":[]},{"id":"2f55bb51.91bc84","type":"template","z":"280a6f57.28406","name":"Template","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{x}},{{y}}{{separator}}{{payload}}","output":"str","x":500,"y":790,"wires":[["4c369444.93aa04","fcc95cd.d2b51a"]]},{"id":"4c369444.93aa04","type":"link out","z":"280a6f57.28406","name":"","links":["81758ae7.d5bd6"],"x":605,"y":790,"wires":[]},{"id":"fcc95cd.d2b51a","type":"debug","z":"280a6f57.28406","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":740,"wires":[]}]

```

I want to get the date go through the `template` node.

Going in I see:

`27/07/20`

Coming out:  
(given the `flow` values are set)

`5,2@27&#x2F;07&#x2F;20`

5 = x  
2 = y  
@ = separator

The `/` is being turned into .... `&#x2f`

Which I guess is the hex code for the `/`.

Sorry to ask the dumb question.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 July 2020 09:14 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/2 "2020-07-27T09:14:40Z")

</div>

change your `debug` nodes to display the 'Complete msg object' and what do you see?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 09:18 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/3 "2020-07-27T09:18:50Z")

</div>

Well, I see this:

```auto
{"_msgid":"9a51bee1.e7b48","topic":"","payload":"5,2@27&#x2F;07&#x2F;20","x":5,"y":2,"separator":"@"}

```

(What happened with the copy/paste from the `debug` window and showing _formatted_ payloads where it would look like what it does in the debug panel?)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 July 2020 09:21 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/4 "2020-07-27T09:21:51Z")

</div>

Ok, in your sample, no msg.x is created because it comes from flow.x which does not exist in the flow you submitted. I will hard code t and take a look.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 09:25 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/5 "2020-07-27T09:25:15Z")

</div>

Check `msg.separator` as well! (`"@"`)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 July 2020 09:26 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/6 "2020-07-27T09:26:57Z")

</div>

Why are you using the `string` node? yoYou don't have any methods defined in it.

 ![Screen Shot 2020-07-27 at 5.25.55 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/3/83e26bd202be8ceacfc2991b3e47ad94820b537b.png)  
 ![Screen Shot 2020-07-27 at 5.26.26 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c44fe5e50900295df97e1d37834bbd3ac58a71c3.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 09:27 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/7 "2020-07-27T09:27:46Z")

</div>

Sorry, I think that is an artefact from another effort.

## Don't forget `flow.separator` !!

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 09:31 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/8 "2020-07-27T09:31:58Z")

</div>

This is a bashup `function` node which gives the desired output:

```auto
msg.payload = msg.x + "," + msg.y + msg.separator + msg.mydom + "/" + msg.mymonthn + "/" + msg.myyear;
return msg;

```

For clarity:

 ![Screenshot from 2020-07-27 19-36-34](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/d/3dd79a966f671904c48b61b576c96ecda27dfb56.png)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 July 2020 09:40 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/9 "2020-07-27T09:40:17Z")

</div>

If you look at the `Info` tab of the `template` node, you will see at the bottom

> **Note:** By default, _mustache_ will escape any non-alphanumeric or HTML entities in the values it substitutes. To prevent this, use `{{{triple}}}` braces.

knowing that, what should your template node look like?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 09:41 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/10 "2020-07-27T09:41:19Z")

</div>

ARGH!

Sorry. I've been here before. It is because I not using it that often, I forget.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 July 2020 09:42 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/11 "2020-07-27T09:42:29Z")

</div>

Don't worry, we all forget things - I had to go looking for that tidbit myself 😉

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 09:43 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/12 "2020-07-27T09:43:07Z")

</div>

Looks good now.

I got a few _problems_ nutted out. Things moving forward.

---

<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:** [10 August 2020 09:43 UTC](https://discourse.nodered.org/t/help-with-what-i-am-seeing-going-through-template-node/30760/13 "2020-08-10T09:43:24Z")

</div>

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