Skip to content

Handling Variables with Same Name in Aggregation Functions #2468

Answered by ngjaying
younes199511 asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry that we forgot to take a look at this. It looks like you have Temperature from two devices. I assume they are in different message, correct? {Temperature: 12, device: 1} then {Temperature: 13, device: 2}. Can you do a pick to rename them right after the source node demo.

       "renamePick": {
              "type": "operator",
              "nodeType": "pick",
              "props": {
                  "fields": [
                      "case when meta(`Temperature`->deviceName)=\"Modbus-1\") then Temperature end as temp1",
                      "case when meta(`Temperature`->deviceName)=\"Modbus-2\") then Temperature end as temp2"
                  ]
              }
          },

The…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@younes199511
Comment options

@ngjaying
Comment options

Answer selected by younes199511
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants