locked
Help in Flatten output RRS feed

  • Question

  • I am new to SA and tryinig to build an Iot Application, but because of format of my telemetry i am not able to flatten the query output 

     [{
        "timestamp": "2018-08-03T06:37:36Z",
        "type": "Gateway",
        "mac": "AC233FC00374",
        "gatewayFree": 90,
        "gatewayLoad": 0.07
      },
      {
        "timestamp": "2018-08-03T06:41:11Z",
        "type": "iBeacon",
        "mac": "AC233FA0327C",
        "bleName": "",    
        "rssi": -57,
        "ibeaconTxPower": -59,
        "battery": 0
      },
      {
        "timestamp": "2018-08-03T06:41:11Z",
        "type": "iBeacon",
        "mac": "AC233FA0327E",
        "bleName": "",    
        "rssi": -57,
        "ibeaconTxPower": -59,
        "battery": 0
      }]

    as you can see in above input stream, i am getting  gateway info with 2 beacons telemetry input. what i am trying to get is flatten the result   i.e. Type gatewayFree gatewayLoad bleName rssi ibeaconTxPower battery.  I tried using 2 jobs based on type using where clause and refer Ist in second but no help. also took look at UDF function but not getting any path . Any help would be appreciated. 

    Sunday, August 5, 2018 4:55 PM

All replies

  • Please help me by clarifying your question. Do you want to merge data in gateway with data in iBeacon ? Please also explain with an input JSON and desired output JSON.
    Monday, August 6, 2018 5:21 PM
  • Hi, by default we will flatten the query. You can start by "SELECT * FROM input" to see the result.

    If you want to query " Type gatewayFree gatewayLoad bleName rssi ibeaconTxPower battery", you can do the following query:

    select  Type, gatewayFree, gatewayLoad, bleName, rssi, ibeaconTxPower, battery from input

    Just make sure your downstream logic can handle NULL value when the value is not provide.

    Let us know if you have any question.

    Thanks,

    JS

    Wednesday, August 8, 2018 5:22 PM