Closed criticalboot closed 1 month ago
@criticalboot You can check in the Browser's network activity, the query with replaced and not replaced variables.
Double check element's id, for example ${payload.station}
should be ${payload. StationId}
based on your payload.
Thinking about it, we can update plugin to display the resulted query in the alert to help with troubleshooting.
@mikhail-vl It's a typo and has been fixed, but the issue remains.
tried to print the SQL in custom code with
payload.sql = `INSERT INTO "Stations"("Number", "stationId", "haltSeqNo", "alert") VALUES (${payload.Number}, ${payload.station}, ${payload.haltSeqNo}, '${payload.alert}')`; console.log(payload);
and got the desired result.
@criticalboot Print won't work, because replace variables happens on the data source level.
Check the query in the network activity for /ds/query
.
@mikhail-vl No network activity was found for this query.
trying to insert geolocation as json into postgres with the following custom code.
payload = {"Number": 12345, "StationId": 1, "haltSeqNo": 13, "lat": 10, "long": 11} payload.alert =
{"lat":${payload.lat},"long":${payload.long}}
INSERT INTO "Stations" ("Number", "stationId", "haltSeqNo", "alert") VALUES (${payload.Number}, ${payload.station}, ${payload.haltSeqNo}, '${payload.alert}')