# Device list function

**URL:** https://community.tago.io/t/device-list-function/1639
**Category:** Analysis and Actions
**Created:** [July 22, 2024, 5:00am UTC](https://community.tago.io/t/device-list-function/1639 "2024-07-22T05:00:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![222925g](https://avatars.discourse-cdn.com/v4/letter/2/ecae2f/32.png) [@222925g](https://community.tago.io/u/222925g)
#### Post date: [July 22, 2024, 5:00am UTC](https://community.tago.io/t/device-list-function/1639/1 "2024-07-22T05:00:47Z")

</div>

Hi,

```
  I would like to know the way that the devices are listed out in the array. Is the devices that is obtained from the Resources.devices.list()listed by the time it is created or by the relevant tags?  

  and is there away to filter their data after obtaining it through this way? :  

for(const device of array\_devices){

  const vari = await Resources.devices.getDeviceData(device.id,{  

    variables: <variable>,

    qty: quantity,

    start\_date: "2024-06-09T16:00",

    end\_date: end

  });

  device\_result.push(vari);

}

```

---

<div class="post-metadata">

### Author: ![222925g](https://avatars.discourse-cdn.com/v4/letter/2/ecae2f/32.png) [@222925g](https://community.tago.io/u/222925g)
#### Post date: [July 22, 2024, 6:44am UTC](https://community.tago.io/t/device-list-function/1639/2 "2024-07-22T06:44:41Z")

</div>

And is it possible to find multiple different variables within the same await Resources.devices.getDeviceData()function

---

<div class="post-metadata">

### Author: ![freddy.minuzzi](https://yyz2.discourse-cdn.com/flex034/user_avatar/community.tago.io/freddy.minuzzi/32/415_2.png) [@freddy.minuzzi](https://community.tago.io/u/freddy.minuzzi)
#### Post date: [July 22, 2024, 12:43pm UTC](https://community.tago.io/t/device-list-function/1639/3 "2024-07-22T12:43:46Z")

</div>

Hi 222925g,

The devices obtained from the _Resources.devices.list()_ method will be listed in an the alphabetical order. You could use the javascript _filter()_ method after using the API or you could also filter it in the query itself using the [DataQuery](https://js.sdk.tago.io/classes/_internal_.Devices.html#getDeviceData).

Yeah, you can get multiple variables using the await _Resources.devices.getDeviceData()_ method by adding them like such:

const myData = await Resources.devices.getDeviceData(deviceID, {

variables: [“temperature”, “humidity”, “pressure”],

qty: 10,

});
