# Questions about Braces Syntax Usage in Mustache Template

**URL:** <https://discourse.nodered.org/t/questions-about-braces-syntax-usage-in-mustache-template/2902>\
**Category:** Dashboard\
**Created:** [6 September 2018 08:20 UTC](https://discourse.nodered.org/t/questions-about-braces-syntax-usage-in-mustache-template/2902 "2018-09-06T08:20:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rishanaziz](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@rishanaziz](https://discourse.nodered.org/u/rishanaziz)\
**Post date:** [6 September 2018 08:20 UTC](https://discourse.nodered.org/t/questions-about-braces-syntax-usage-in-mustache-template/2902/1 "2018-09-06T08:20:19Z")

</div>

Hi all,

I returned three messages in an array from a function. All three messages are returned in JSON format.

The following is the result that I can see in debug:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/b259e125d7d229379c2b3a2dfbc32a355cc1e629.png)

How to pass these three messages in mustache template (**payload[0]**, **payload[1]** and **payload[2]** separately)?

I aware that payload[0], payload[1] and payload[2] are the values, but I don't think **payload[0]** syntax will work in mustache template.

I also have another question. For example, I have the following function:

```auto
msg.topic="SELECT * FROM location";

var msg1={};
msg1.topic="SELECT * FROM type";

return [msg,msg1];

```

If I'm passing **msg** value to mustache template, **{{{payload}}}** is the syntax.

If I'm passing **msg1** value to the mustache template, how is the syntax going to be?

Thanks for helping.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [6 September 2018 08:49 UTC](https://discourse.nodered.org/t/questions-about-braces-syntax-usage-in-mustache-template/2902/2 "2018-09-06T08:49:17Z")

</div>

Hi,

to access array properties in mustache syntax, you have to use the dot-syntax: `payload.0`

> [@rishanaziz](#):
>
> If I'm passing **msg** value to mustache template, **{{{payload}}}** is the syntax.
> 
> If I'm passing **msg1** value to the mustache template, how is the syntax going to be?

When you return two messages from a Function with `[msg , msg1]`, then `msg` will be sent out of the first Function node output and `msg1` will be sent out of the second output.

If you return `[[msg, msg1] ]` then they will be both sent from the first output, one after the other. That is an important thing to understand - they are sent one after the other. The Template node does not receive both messages at the same time - they arrive as individual messages.

It does not matter what you called the local variable in the Function node, when a message arrives at a Template node its _the_ message. So `{{{payload}}}` will always refer to the payload property of _the_ message the Template node is currently handling.

---

<div class="post-metadata">

**Author:** ![rishanaziz](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@rishanaziz](https://discourse.nodered.org/u/rishanaziz)\
**Post date:** [11 September 2018 05:31 UTC](https://discourse.nodered.org/t/questions-about-braces-syntax-usage-in-mustache-template/2902/3 "2018-09-11T05:31:56Z")

</div>

Hi Nick,

Thanks for the explanation.

I'm using JSGrid to display data and perform CRUD operation. The fields with type "select" (dropdown) are not displaying data. Once I click to add and edit data, I'm unable to make the fields to appear as dropdown with options from the database (e.g. Location\_Name from location table). I just would like to make this work.

Here's the link of the topic for more information: [Gridview with CRUD Options (MySQL)](https://discourse.nodered.org/t/gridview-with-crud-options-mysql/2244)

I tried the following syntax to access array properties in mustache template, but I'm unable to display the data. Maybe the syntax is incorrect.

```auto
var db = {{{payload.0}}}; //payload[0] (Data for main)
var loc = {{{payload.1}}}; //payload[1] (Data for dropdown 1)
var mac = {{{payload.2}}} //payload[2] (Data for dropdown 2)

{
	title: "Location",
	name: "location",
	type: "select",
	items: loc,
	width: 100
}

{
	title: "Type",
	name: "type",
	type: "select",
	items: mac,
	width: 100
}

```

Hope to hear from you soon. Thanks for helping.
