# S7 Contrib vars to table

**URL:** <https://discourse.nodered.org/t/s7-contrib-vars-to-table/5033>\
**Category:** Dashboard\
**Created:** [19 November 2018 10:48 UTC](https://discourse.nodered.org/t/s7-contrib-vars-to-table/5033 "2018-11-19T10:48:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wagner\_Amaral](https://avatars.discourse-cdn.com/v4/letter/w/e274bd/32.png) [@Wagner\_Amaral](https://discourse.nodered.org/u/Wagner_Amaral)\
**Post date:** [19 November 2018 10:48 UTC](https://discourse.nodered.org/t/s7-contrib-vars-to-table/5033/1 "2018-11-19T10:48:46Z")

</div>

Hy fellows;

I'm learning about Node-red, I'm a PLC programer and I'm trying to make a simple table, what is the best way to perform it? "this is the flow..."

[{"id":"d4d0e1ed.32f82","type":"tab","label":"Flow 2"},{"id":"b197a359.0a129","type":"debug","z":"d4d0e1ed.32f82","name":"tabelafinal","active":false,"console":"false","complete":"true","x":690,"y":180,"wires":[]},{"id":"cda94a49.1ce738","type":"ui\_template","z":"d4d0e1ed.32f82","group":"90c79bc4.11d9e8","name":"","order":0,"width":0,"height":0,"format":"\<!DOCTYPE html\>\n\<html\>\n\<body\>\n\n\<h2\>Basic HTML Table\</h2\>\n\n\<table style=&quot;width:100%&quot; id=&quot;table&quot; border=&quot;1&quot;\>\n \<tr\>\n \<th\>Sample 1\</th\>\n \<th\>Sample 2\</th\> \n \<th\>Sample 3\</th\>\n \</tr\>\n \<tr\>\n \<td\>Var 1\</td\>\n \<td\>Var 2\</td\>\n \<td\>Var 3\</td\>\n \</tr\>\n \n\</table\>\n\n\</body\>\n\</html\>","storeOutMessages":true,"fwdInMessages":true,"x":540,"y":120,"wires":[["b197a359.0a129"]]},{"id":"c07e23b5.002ae","type":"debug","z":"d4d0e1ed.32f82","name":"S71200Log","active":false,"console":"false","complete":"true","x":330,"y":200,"wires":[]},{"id":"65492108.50f5f","type":"s7 in","z":"d4d0e1ed.32f82","endpoint":"3ae16e4d.97c452","mode":"all","variable":"Air Flow Main Blower","diff":false,"name":"S71200","x":150,"y":120,"wires":[["c07e23b5.002ae","cda94a49.1ce738"]]},{"id":"90c79bc4.11d9e8","type":"ui\_group","z":"","name":"Table with sample's Var","tab":"81897283.4000e","disp":true,"width":"32"},{"id":"3ae16e4d.97c452","type":"s7 endpoint","z":"","address":"192.168.10.10","port":"102","rack":"0","slot":"1","localtsaphi":"01","localtsaplo":"00","remotetsaphi":"01","remotetsaplo":"00","connmode":"rack-slot","cycletime":"500","timeout":"1500","verbose":"off","name":"PLC1","vartable":[{"addr":"DB48,REAL94","name":"VAR 1"},{"addr":"DB48,REAL110","name":"VAR 2"},{"addr":"DB48,REAL90","name":"VAR 3"}]},{"id":"81897283.4000e","type":"ui\_tab","z":"","name":"Table with Sample's Var","icon":"dashboard","order":3}]

---

<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:** [19 November 2018 11:13 UTC](https://discourse.nodered.org/t/s7-contrib-vars-to-table/5033/2 "2018-11-19T11:13:25Z")

</div>

when pasting flows, please follow the directions in [How to import a flow into the editor](https://discourse.nodered.org/t/how-to-import-a-flow-into-the-editor/895)

You can edit your post to fix the flow.

---

<div class="post-metadata">

**Author:** ![Wagner\_Amaral](https://avatars.discourse-cdn.com/v4/letter/w/e274bd/32.png) [@Wagner\_Amaral](https://discourse.nodered.org/u/Wagner_Amaral)\
**Post date:** [19 November 2018 11:30 UTC](https://discourse.nodered.org/t/s7-contrib-vars-to-table/5033/3 "2018-11-19T11:30:16Z")

</div>

Hi, I just use the top right option "export" on the node-red to export my 4 nodes, it's a wrong mode? How can Is the right way?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [19 November 2018 11:34 UTC](https://discourse.nodered.org/t/s7-contrib-vars-to-table/5033/4 "2018-11-19T11:34:27Z")

</div>

Please read the article that @zenofmud linked to

---

<div class="post-metadata">

**Author:** ![Wagner\_Amaral](https://avatars.discourse-cdn.com/v4/letter/w/e274bd/32.png) [@Wagner\_Amaral](https://discourse.nodered.org/u/Wagner_Amaral)\
**Post date:** [19 November 2018 12:00 UTC](https://discourse.nodered.org/t/s7-contrib-vars-to-table/5033/5 "2018-11-19T12:00:44Z")

</div>

Hi everybody;

Sorry by the delay and my poor english, now can anybody copy and past my flow to help me?

Tks...

---

<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:** [19 November 2018 12:20 UTC](https://discourse.nodered.org/t/s7-contrib-vars-to-table/5033/6 "2018-11-19T12:20:32Z")

</div>

Since you are new to learning about NR, I suggest you go to the 'flows' tab of the website and search for 'table' and uncheck the 'nodes' box.

You should find a number of flows showing examples of creating tables. Import some of tehm and see if you understant them. This should help you figure out what you need to do.

If you get stuck, please ask a specific question and provide the flow you are using.

---

<div class="post-metadata">

**Author:** ![Wagner\_Amaral](https://avatars.discourse-cdn.com/v4/letter/w/e274bd/32.png) [@Wagner\_Amaral](https://discourse.nodered.org/u/Wagner_Amaral)\
**Post date:** [19 November 2018 13:06 UTC](https://discourse.nodered.org/t/s7-contrib-vars-to-table/5033/7 "2018-11-19T13:06:11Z")

</div>

So, I start to view the examples of this page:  
[https://flows.nodered.org/flow/796e6b70ad239ea4c118d2911ff2f2ed](https://flows.nodered.org/flow/796e6b70ad239ea4c118d2911ff2f2ed), and this [https://flows.nodered.org/flow/76cd6afbd14426f88656c90aedf10423](https://flows.nodered.org/flow/76cd6afbd14426f88656c90aedf10423), but the numbers of this examples are fixed by hand in the function node, how can I adapt one of this functions to read the payload value and the topic name of my "S7 In" node? Have anybody another example flow to adapt?

My "S7 In" it's config to answer "All variables, one per message", and I have more 2 options, "one variable" and "All Variables".

The debug node of my "S7 IN" node answer to me 3 objects at same time, it's my 3 variables:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/81a221b94eedf6ebc7d324ae4ad8782c13c53042.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:** [19 November 2018 15:43 UTC](https://discourse.nodered.org/t/s7-contrib-vars-to-table/5033/8 "2018-11-19T15:43:44Z")

</div>

are all of these going to be part of the data you need to save? If so you should use a join node to create one message with the key:value pair of each of those messagesf

---

<div class="post-metadata">

**Author:** ![mischkasmith](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mischkasmith/32/31586_2.png) [@mischkasmith](https://discourse.nodered.org/u/mischkasmith)\
**Post date:** [25 November 2018 22:57 UTC](https://discourse.nodered.org/t/s7-contrib-vars-to-table/5033/9 "2018-11-25T22:57:18Z")

</div>

Try this.

`[{"id":"8926661f.7ec008","type":"inject","z":"b4aaf4e3.27fb68","name":"","topic":"","payload":"{\"VAR1\":10,\"VAR2\":20,\"VAR3\":30,\"VAR4\":40}","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":330,"y":420,"wires":[["42a7b0af.3e192"]]},{"id":"909f9c7f.19b33","type":"debug","z":"b4aaf4e3.27fb68","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":670,"y":300,"wires":[]},{"id":"6a43ae9b.ca7af","type":"s7 in","z":"b4aaf4e3.27fb68","endpoint":"aa4a1fa7.53de48","mode":"all","variable":"","diff":true,"name":"","x":350,"y":320,"wires":[["909f9c7f.19b33","42a7b0af.3e192"]]},{"id":"2c68fb9.f9d5a04","type":"ui_template","z":"b4aaf4e3.27fb68","group":"1d8875f2.ba71aa","name":"","order":2,"width":0,"height":0,"format":"\n<style>\n {{msg.style}}\n</style>\n\n\n<div id=tables>\n<table>\n <tr>\n <td class=\"column\">{{msg.payload.VAR1}}</td>\n <td class=\"column\">{{msg.payload.VAR2}}</td>\n </tr> \n <tr>\n <td class=\"column\">{{msg.payload.VAR3}}</td>\n <td class=\"column\">{{msg.payload.VAR4}}</td>\n </tr>\n</table>\n</div>\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":860,"y":380,"wires":[[]]},{"id":"42a7b0af.3e192","type":"template","z":"b4aaf4e3.27fb68","name":"css","field":"style","fieldType":"msg","format":"css","syntax":"mustache","template":"\n\ntable {\n border: 0px solid black;\n //width: -moz-available;\n width: 50%;\n float: left;\n}\n\nth, td {\n border: 2px solid black;\n border-collapse: collapse;\n font-size: 50px;\n overflow:hidden;\n height: 74px;\n padding: 8px;\n}\n","output":"str","x":630,"y":380,"wires":[["2c68fb9.f9d5a04"]]},{"id":"aa4a1fa7.53de48","type":"s7 endpoint","z":"","address":"192.168.102.240","port":"102","rack":"0","slot":"2","localtsaphi":"01","localtsaplo":"00","remotetsaphi":"01","remotetsaplo":"00","connmode":"rack-slot","cycletime":"1000","timeout":"3000","verbose":"default","name":"","vartable":[{"addr":"DB555,INT2","name":"VAR1"},{"addr":"DB555,S4.16","name":"VAR2"},{"addr":"DB555,INT22","name":"VAR3"},{"addr":"DB555,S24.16","name":"VAR4"}]},{"id":"1d8875f2.ba71aa","type":"ui_group","name":"Group 1","tab":"3f5dffa2.f7cbf","order":1,"disp":true,"width":6},{"id":"3f5dffa2.f7cbf","type":"ui_tab","name":"Tab 2","icon":"dashboard","order":2}]`
