Getting Value from Payload

Hello,

i dont like to ask that question but i really cant see a solution.

I get a payload like this:

sqlpayload

i used to get the values with:

msg.payload[0].Getriebe_Betriebsstunden
msg.payload[0].Zaehlerstand

but i dont get the values anymore.

May be someone can see what i am doing wrong ?

Hey

Not sure.. But what about "msg.payload.Getriebe_Betriebsstunden"?
You can copy the path in the debug mode. But I don't think that's the problem.

mhmm i even dont get:

msg.payload.test = "test";

in the payload.

thats strange

Can you paste your flow? So I can look at it.

the message comes from an SQL Node and passes a funcion node.

so the easiest thing should be adding a payload to that message.

i think i am doing something stupid that that dont work...

Part of the Flow after SQL Node:

global16

[{"id":"8141661b.7eec98","type":"function","z":"eb7b6cd.dbec29","name":"Read Globalisierung W16","func":"msg.payload.test = 1;\n//global.set('W16Bhreaded', msg.payload[0].Getriebe_Betriebsstunden);\nglobal.set(msg._topic+'Bhreaded', msg.payload[0].Getriebe_Betriebsstunden);               //Pst Betriebsstunden\nglobal.set(msg._topic+'Zaehlerstand', msg.payload[0].Zaehlerstand);                       //Zähler allgemeine Betriebstunden Pst\n//global.set(msg._topic+'Getriebe_Betriebsstunden',global.get(msg._topic+'Bhreaded'));      //Umleitung für die Tabellenanzeige\nmsg.payload.W12Bhreaded = global.get('W12Bhreaded');\n//msg.payload.W12Zaehlerstand = global.get('Zaehlerstand');\nmsg.payload.W12Zaehlerstand = msg.payload.Zaehlerstand;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2630,"y":1020,"wires":[[]]},{"id":"bdf56dc4.6b204","type":"switch","z":"eb7b6cd.dbec29","name":"Read Out Splitter","property":"_topic","propertyType":"msg","rules":[{"t":"eq","v":"W01","vt":"str"},{"t":"eq","v":"W01.2","vt":"str"},{"t":"eq","v":"W02","vt":"str"},{"t":"eq","v":"W03","vt":"str"},{"t":"eq","v":"W03.2","vt":"str"},{"t":"eq","v":"W04","vt":"str"},{"t":"eq","v":"W05","vt":"str"},{"t":"eq","v":"W06","vt":"str"},{"t":"eq","v":"W07","vt":"str"},{"t":"eq","v":"W08","vt":"str"},{"t":"eq","v":"W09","vt":"str"},{"t":"eq","v":"W10","vt":"str"},{"t":"eq","v":"W11","vt":"str"},{"t":"eq","v":"W12","vt":"str"},{"t":"eq","v":"W13","vt":"str"},{"t":"eq","v":"W14","vt":"str"},{"t":"eq","v":"W15","vt":"str"},{"t":"eq","v":"W16","vt":"str"},{"t":"eq","v":"W17","vt":"str"}],"checkall":"true","repair":false,"outputs":19,"x":2350,"y":920,"wires":[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],["8141661b.7eec98"],[]]},{"id":"93fb8f5f.0b3a5","type":"comment","z":"eb7b6cd.dbec29","name":"Here is the SQL Node","info":"","x":2160,"y":920,"wires":[]}]  

with:
msg.payload[0].abc = "abc";

i get:
globaloutput1

so i am not able to add normal payload variables, may be its the same with setting global variables.

Ok, here is the solution:

i could read the Values, but wasnt able to show them as msg.payload.value i had to use msg.payload[0].value because of the structure of the mesage.

Thank you!

Ooh, oké! Goodluck :slight_smile:

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