Sort msg.payload Arrays into sections

Ok so for step one of any one wanting to help you out is to get the data that needs to be manipulated.
It can be static and a one off

So you create a flow like this:

[{"id":"3d8b5600.b8529a","type":"inject","z":"32b9138.e8e466c","name":"","topic":"","payload":"","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":370,"y":320,"wires":[["edbb9fbe.c16818"]]},{"id":"9d4b75a8.a7b28","type":"debug","z":"32b9138.e8e466c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":750,"y":320,"wires":[]},{"id":"edbb9fbe.c16818","type":"function","z":"32b9138.e8e466c","name":"FAKE MSG.PAYLOAD","func":"\n\nmsg.payload1 = \n{\n    \"value\":\n    {\n        \"len\":644,\n        \"objectId\":\n        {\n            \"unknown\":'unknown'\n        },\n        \"property\":\n        {\n            \"unknown\":'unknown'\n        },\n        \"values\":\n        [\n            1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47\n        ]\n    }\n}\n    \n\n\n\nreturn msg;\n","outputs":1,"noerr":0,"x":560,"y":320,"wires":[["9d4b75a8.a7b28"]]}]

Please import this into a flow

as you can see it creates a mimmic of your msg.payload1 without needing to have all of your nodes.

helpme

I can see it goes deeper tan the array I made. can you pleas edit/finish the code to create a good mimmic of your msg.payload1

each {"type":12,"value":{"type":2,"instance":3001614}}, is an array the data i really want is {"type":2,"instance":3001614} lol i planed on doing splinting and sorting to achieve getting just this value.

This works with your payload

m = msg.payload.payload1.value.values

let i,j,t,c=10;

for (i=0,j=m.length; i<j; i+=c) {
    t = m.slice(i,i+c);
    node.send({payload:t})
}

how do i add the below after 0:

image

what is carried in payload1 is valid JSON. why not to parse using proper tools?

please read https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506

because @Navybrandon stated he planned on making this work with the dashboard UI. Figured he needed to start somewhere

@meeki007
my flow is too large to share. it also calls upon other flows so the import limit is reached.

[{"id":"f18f1dc3.a83ae","type":"function","z":"1fea49bd.2c3b16","name":"FAKE MSG.PAYLOAD","func":"\n\nmsg.payload1 = \n{\n    \"value\":\n    {\n        \"len\":644,\n        \"objectId\":\n        {\n            type: 8,\n            instance: 532897\n        },\n        \"property\":\n        {\n            id: 76,\n            index: 4294967295\n        },\n        \"values\":\n        [\n            \"0\": {\n                type: 12\n            },\n       \"value\": {\n            type: 8,\n            instance: 532897\n            },\n            }\n            ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47\n        ]\n    }\n}\n    \n\n\n\nreturn msg;\n","outputs":1,"noerr":9,"x":1180,"y":860,"wires":[["ac366f78.8305e"]]}]

@bakman2

I re-ran that function and error was cannot read property of 'value' of undefined.

Your screenshot did not show this:

msg.payload.payload1.value.values

Which is why it failed.

@Navybrandon how do i add the below after 0:

please import this

[{"id":"3d8b5600.b8529a","type":"inject","z":"32b9138.e8e466c","name":"","topic":"","payload":"","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":370,"y":320,"wires":[["edbb9fbe.c16818"]]},{"id":"9d4b75a8.a7b28","type":"debug","z":"32b9138.e8e466c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":750,"y":320,"wires":[]},{"id":"edbb9fbe.c16818","type":"function","z":"32b9138.e8e466c","name":"FAKE MSG.PAYLOAD","func":"\n\nmsg.payload1 = \n{\n    \"value\":\n    {\n        \"len\":644,\n        \"objectId\":\n        {\n            \"unknown\":'unknown'\n        },\n        \"property\":\n        {\n            \"unknown\":'unknown'\n        },\n        \"values\":\n        [\n            \n            {\n                \"type\":12,\n                \"value\":\n                {\n                    \"type\":8,\n                    \"instance\":532897\n                }\n            },\n            {\n                \"type\":13,\n                \"value\":\n                {\n                    \"type\":9,\n                    \"instance\":732897\n                }\n            }\n        ]\n    }\n}\n    \n\n\n\nreturn msg;\n","outputs":1,"noerr":0,"x":560,"y":320,"wires":[["9d4b75a8.a7b28"]]}]

I understand your flow is too big. this is why we are creating this one off mimmic

please add in values and make sure to add one or two values you need to sort for.

after we get a good mimmic, together, we will code you up something that will sort for what you need

NOTE we only need like 12-18 values dont do 127 in the array

[{"id":"bc759fb6.601a4","type":"inject","z":"1fea49bd.2c3b16","name":"","topic":"","payload":"","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":990,"y":860,"wires":[["f18f1dc3.a83ae"]]},{"id":"ac366f78.8305e","type":"debug","z":"1fea49bd.2c3b16","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1370,"y":860,"wires":[]},{"id":"f18f1dc3.a83ae","type":"function","z":"1fea49bd.2c3b16","name":"FAKE MSG.PAYLOAD","func":"\n\nmsg.payload1 = \n{\n    \"value\":\n    {\n        \"len\":644,\n        \"objectId\":\n        {\n            type: 8,\n            instance: 532897\n        },\n        \"property\":\n        {\n            id: 76,\n            index: 4294967295\n        },\n        \"values\":\n        [\n            \"0\": \n            {\n                type: 12\n            },\n                \"value\": \n                  {\n                      type: 8,\n                     instance: 532897\n                     },\n    }\n            ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47\n        ]\n    }\n}\n    \n\n\n\nreturn msg;\n","outputs":1,"noerr":9,"x":1180,"y":860,"wires":[["ac366f78.8305e"]]}]

I understand that but when you look at above you see i am getting errors when trying to add details after the 0 array. i will add like 20 once i get the formatting right.

Working flow with your data:

[{"id":"af57b13e.3db998","type":"inject","z":"dab2d900.213ea","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":312,"y":264,"wires":[["2c4bb42.b3f64cc"]]},{"id":"2c4bb42.b3f64cc","type":"function","z":"dab2d900.213ea","name":"","func":"payload = {\"Bacnet\":\"532897\",\"payload1\":{\"value\":{\"len\":644,\"objectId\":{\"type\":8,\"instance\":532897},\"property\":{\"id\":76,\"index\":4294967295},\"values\":[{\"type\":12,\"value\":{\"type\":8,\"instance\":532897}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001542}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001587}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001589}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001591}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001593}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001594}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001595}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001597}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001598}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001599}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001600}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001601}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001602}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001603}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001606}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001607}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001608}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001609}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001610}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001613}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001614}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001615}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001617}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001621}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001625}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001627}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001629}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3001633}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002186}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002188}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002194}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002199}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002200}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002201}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002202}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002203}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002204}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002393}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002394}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002395}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002397}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002401}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002404}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002405}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002406}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002408}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002409}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002410}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002412}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002416}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002481}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002482}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002484}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002485}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002488}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002490}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002491}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3002493}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3003932}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3003933}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3003936}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3003937}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3003943}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3003944}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3003946}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3003948}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3003949}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3003950}},{\"type\":12,\"value\":{\"type\":2,\"instance\":3004089}},{\"type\":12,\"value\":{\"type\":5,\"instance\":3002205}},{\"type\":12,\"value\":{\"type\":16,\"instance\":3001584}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001539}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001540}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001543}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001544}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001545}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001546}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001596}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001605}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001611}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001616}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001620}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001622}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001624}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001626}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001628}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001630}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001631}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3001632}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002185}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002187}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002189}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002192}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002195}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002196}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002197}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002392}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002398}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002402}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002403}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002476}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002477}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002483}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002486}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002487}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3002489}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003916}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003917}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003918}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003919}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003920}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003921}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003934}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003935}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003938}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003939}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003940}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003941}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003942}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003945}},{\"type\":12,\"value\":{\"type\":19,\"instance\":3003947}},{\"type\":12,\"value\":{\"type\":20,\"instance\":3000005}},{\"type\":12,\"value\":{\"type\":20,\"instance\":3001649}},{\"type\":12,\"value\":{\"type\":20,\"instance\":3001650}},{\"type\":12,\"value\":{\"type\":20,\"instance\":3002181}},{\"type\":12,\"value\":{\"type\":20,\"instance\":3002497}}]}}}\n\nreturn {payload:payload}","outputs":1,"noerr":0,"x":458,"y":264,"wires":[["3f2389b0.44c73e"]]},{"id":"81879e8c.ea97a8","type":"debug","z":"dab2d900.213ea","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":766,"y":264,"wires":[]},{"id":"3f2389b0.44c73e","type":"function","z":"dab2d900.213ea","name":"","func":"m = msg.payload.payload1.value.values\n\nlet i,j,t,c=10;\n\nfor (i=0,j=m.length; i<j; i+=c) {\n    t = m.slice(i,i+c);\n    node.send({payload:t})\n}\n\n\n","outputs":1,"noerr":0,"x":602,"y":264,"wires":[["81879e8c.ea97a8"]]}]

the above is wrong its the first export i sent you.

dont rush this. I have hours to goof off on the forum today. take your time I'm not going anywhere

OK I see this sorts them into arrays of 10

now what do you want to do after that. not the end goal just what do you need and what do you want it to do

Well im lost for words your example works but when i add this to the end on my function that is sending the payload it does not work.

i only added the second function after the read function that sends the payload1.

@Navybrandon

I think you missed my last export.

please read this again

@Navybrandon how do i add the below after 0:

please import this

[{"id":"3d8b5600.b8529a","type":"inject","z":"32b9138.e8e466c","name":"","topic":"","payload":"","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":370,"y":320,"wires":[["edbb9fbe.c16818"]]},{"id":"9d4b75a8.a7b28","type":"debug","z":"32b9138.e8e466c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":750,"y":320,"wires":[]},{"id":"edbb9fbe.c16818","type":"function","z":"32b9138.e8e466c","name":"FAKE MSG.PAYLOAD","func":"\n\nmsg.payload1 = \n{\n    \"value\":\n    {\n        \"len\":644,\n        \"objectId\":\n        {\n            \"unknown\":'unknown'\n        },\n        \"property\":\n        {\n            \"unknown\":'unknown'\n        },\n        \"values\":\n        [\n            \n            {\n                \"type\":12,\n                \"value\":\n                {\n                    \"type\":8,\n                    \"instance\":532897\n                }\n            },\n            {\n                \"type\":13,\n                \"value\":\n                {\n                    \"type\":9,\n                    \"instance\":732897\n                }\n            }\n        ]\n    }\n}\n    \n\n\n\nreturn msg;\n","outputs":1,"noerr":0,"x":560,"y":320,"wires":[["9d4b75a8.a7b28"]]}]