Search code examples
concatenationthingsboard

i want to take multiple keys and concatenate them into a single key how would i do that in thingsboard


i want to send via MQTT something that needs values from many different keys concatenated together im not sure how to go about it

i tried a script in the rule chain and tried the behavior section in the widgets to make it happen, i wanted to try inside the downlink to find a function that would take the value of the telemetry without the message being sent to the downlink but so far have been unsuccessful


Solution

  • You could try using the "originator attributes" node. In it, you can select the telemetry/attribute keys you want, and they will be added to the message. Then, using the "script" node, you could capture the keys as follows and generate a new message from them. Hope it helps!

    Code to generate new key based on concatenated keys

    Result