I have a flow calling data from a postgresql.
The table have two field - (sent SERIAL PRIMARY KEY, sentype jsonb);
I currently have only two entries.
The call to the DB I receive the array containing all the data.
object
payload: array[2]
0: object
sent: 1
sentype: object
sencom: "Digital matters Oyster"
verfware: "0.0.1"
verhware: "0.0.1"
1: object
sent: 2
sentype: object
sencom: "Abeeway Compact tracker"
verfware: "0.0.1"
verhware: "0.0.1"
topic: ""
_msgid: "e04b44b6059d1340"
pgsql: object
parts: object
complete: true
I split and re arrange the data, here I check the data and both msg looks good and the msg.parts is still there
msg1
object
payload: object
sent: 1
Sensor_Type: 1
sencom: "Digital matters Oyster"
verfware: "0.0.1"
verhware: "0.0.1"
topic: ""
parts: object
parts: object
id: "c886b5c1c58cd1ce"
type: "array"
count: 2
len: 1
index: 0
complete: true
_msgid: "25d6f83353f791e3"
msg2
object
payload: object
sent: 2
Sensor_Type: 2
sencom: "Abeeway Compact tracker"
verfware: "0.0.1"
verhware: "0.0.1"
topic: ""
parts: object
parts: object
id: "c886b5c1c58cd1ce"
type: "array"
count: 2
len: 1
index: 1
complete: true
_msgid: "56bca7b166b935a3"
Now I join them, I get two msg. returned, the firs one is exactly like msg1 above and the other one is a array with msg.payload.0 : undefined.
Any ideas pointers will be appreciated.
PS. Installed this copy of Node-Red 4-5 days ago.
msg1 join
object
payload: array[1]
0: object
sent: 1
Sensor_Type: 1
sencom: "Digital matters Oyster"
verfware: "0.0.1"
verhware: "0.0.1"
topic: ""
parts: object
id: 0.023315470394176918
type: "array"
index: 0
count: 1
_msgid: "25d6f83353f791e3
Join msg
object
payload: array[2]
0: undefined
1: object
sent: 2
Sensor_Type: 2
sencom: "Abeeway Compact tracker"
verfware: "0.0.1"
verhware: "0.0.1"
topic: ""
parts: object
id: 0.023315470394176918
type: "array"
index: 0
count: 1
_msgid: "56bca7b166b935a3"
[
{
"id": "a2b7e605e4a2f886",
"type": "postgresql",
"z": "8db895d9ab727bbc",
"name": "SELECT * FROM sentype;",
"query": "SELECT * FROM sentype;",
"postgreSQLConfig": "4705b0c3b6edca45",
"split": true,
"rowsPerMsg": "100",
"outputs": 1,
"x": 420,
"y": 500,
"wires": [
[
"f759a08192ecfd57",
"ea3287d50431f64d"
]
]
},
{
"id": "5754f606bf6da040",
"type": "ui_table",
"z": "8db895d9ab727bbc",
"group": "ef81eae920809f6a",
"name": "Table Sensor Type",
"order": 1,
"width": "27",
"height": "7",
"columns": [],
"outputs": 0,
"cts": false,
"x": 1130,
"y": 500,
"wires": []
},
{
"id": "a4166c394c601307",
"type": "inject",
"z": "8db895d9ab727bbc",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "2",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 500,
"wires": [
[
"a2b7e605e4a2f886"
]
]
},
{
"id": "54dd39ca851824ec",
"type": "debug",
"z": "8db895d9ab727bbc",
"name": "Split",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 710,
"y": 620,
"wires": []
},
{
"id": "76dc74a888212fb1",
"type": "change",
"z": "8db895d9ab727bbc",
"name": "",
"rules": [
{
"t": "set",
"p": "payload.Sensor_Type",
"pt": "msg",
"to": "payload.sent",
"tot": "msg"
},
{
"t": "set",
"p": "payload.sencom",
"pt": "msg",
"to": "payload.sentype.sencom",
"tot": "msg"
},
{
"t": "set",
"p": "payload.verfware",
"pt": "msg",
"to": "payload.sentype.verfware",
"tot": "msg"
},
{
"t": "set",
"p": "payload.verhware",
"pt": "msg",
"to": "payload.sentype.verfware",
"tot": "msg"
},
{
"t": "delete",
"p": "pgsql",
"pt": "msg"
},
{
"t": "delete",
"p": "payload.sentype",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 780,
"y": 500,
"wires": [
[
"77ddc73dd06e13b9",
"0baf89e4943caefb"
]
]
},
{
"id": "f759a08192ecfd57",
"type": "split",
"z": "8db895d9ab727bbc",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 610,
"y": 500,
"wires": [
[
"76dc74a888212fb1",
"54dd39ca851824ec"
]
]
},
{
"id": "77ddc73dd06e13b9",
"type": "join",
"z": "8db895d9ab727bbc",
"name": "",
"mode": "auto",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": true,
"timeout": "",
"count": "",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "num",
"reduceFixup": "",
"x": 950,
"y": 500,
"wires": [
[
"5754f606bf6da040",
"0b95d4112f56a078"
]
]
},
{
"id": "0baf89e4943caefb",
"type": "debug",
"z": "8db895d9ab727bbc",
"name": "Rules",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 790,
"y": 560,
"wires": []
},
{
"id": "0b95d4112f56a078",
"type": "debug",
"z": "8db895d9ab727bbc",
"name": "Join",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 1010,
"y": 560,
"wires": []
},
{
"id": "ea3287d50431f64d",
"type": "debug",
"z": "8db895d9ab727bbc",
"name": "SELECT * FROM sentype;",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 480,
"y": 560,
"wires": []
},
{
"id": "4705b0c3b6edca45",
"type": "postgreSQLConfig",
"name": "",
"host": "139.162.239.60",
"hostFieldType": "str",
"port": "5432",
"portFieldType": "num",
"database": "soiot_db",
"databaseFieldType": "str",
"ssl": "false",
"sslFieldType": "bool",
"max": "10",
"maxFieldType": "num",
"min": "1",
"minFieldType": "num",
"idle": "1000",
"idleFieldType": "num",
"connectionTimeout": "10000",
"connectionTimeoutFieldType": "num",
"user": "soiot_backend_user",
"userFieldType": "str",
"password": "zxcvbasdfgqwert",
"passwordFieldType": "str"
},
{
"id": "ef81eae920809f6a",
"type": "ui_group",
"name": "Sensor Type",
"tab": "22a6f54d87b61515",
"order": 2,
"disp": true,
"width": "36",
"collapse": false,
"className": ""
},
{
"id": "22a6f54d87b61515",
"type": "ui_tab",
"name": "DB Managment",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]