We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Originally posted by robodevchampion August 23, 2024 I have data coming like below after executing SQL
{'device_name': 'sensor2', 'ts': '1724231947811', 'values': {'combine': '41:107', 'humidity': 41, 'temperature': '30'}}
Added an action for insertion data in DB, I have enabled send single as False
Below is the data template I am using
[ {{- $firstMsg := true -}} {{- range $i, $msg := . -}} {{- $firstKey := true -}} {{- range $key, $value := $msg.values -}} {{- if not $firstKey -}},{{- end -}} {{- $firstKey = false -}} { "deviceid": "{{$msg.device_name}}", "ts": "{{$msg.ts}}", "key_name": "{{$key}}", "value": "{{$value}}" } {{- end -}} {{- if not $firstMsg -}},{{- end -}} {{- $firstMsg = false -}} {{- end -}} ]
Below is the error I got:
fail to decode data [{ "deviceid": "sensor1", "ts": "1724231947811", "key_name": "combine", "value": "40:107" },{ "deviceid": "sensor1", "ts": "1724231947811", "key_name": "humidity", "value": "40" },{ "deviceid": "sensor1", "ts": "1724231947811", "key_name": "temperature", "value": "200" }] after applying dataTemplate for error json: cannot unmarshal array into Go value of type map[string]interface {}
Can you help me what I am missing, above data format is desired.
Thanks
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Discussed in #3141
Originally posted by robodevchampion August 23, 2024
I have data coming like below after executing SQL
{'device_name': 'sensor2', 'ts': '1724231947811', 'values': {'combine': '41:107', 'humidity': 41, 'temperature': '30'}}
Added an action for insertion data in DB, I have enabled send single as False
Below is the data template I am using
Below is the error I got:
Can you help me what I am missing, above data format is desired.
Thanks
The text was updated successfully, but these errors were encountered: