Adding Gateway ID into AWS IOT Dataset

I’m trying to pull the visible Gateway IDs reported by TTN into my dataset on AWS IOT, so I can track movement of my devices in the field. I’ve tried test query a few times with select metadata.gateways.gtw_id from my_datastore and a few different versions of this but I get an error that gateways is not of type ROW so it rejects the query. I have all of my other regular payload fields properly populating. What am I missing?

Did you notice gateways is an array? It can contain multiple elements. I would expect you need to specify at least which from of the elements you want the gtwid.
However I don’t use AWS IoT (yet) so I might be missing the actual problem by a mile.

@kersing I think your correct, the error @dnear1is seeing is due to the gateway data being an array rather than an object. What type of action are you executing as a result of your rule and is it the select or the action from which you are getting that error?

I haven’t set up any rule yet. For now, I was hoping to capture the visible Gateways to fill in historical locational data I don’t have properly recorded.

My query when I remove the gateway ID works perfectly.

You probably want to be capturing not just the gateways, but their respective RSSI’s.

If you have to simplify, simplify to recording the gateway with the strongest RSSI. But then you may see some random positioning jumping as the nearest gateway will inevitably occasionally miss a packet that another picks up, either due to local noise or because it is busy transmitting to someone else.