# Query by condition with Data Series Node

**URL:** <https://forums.losant.com/t/query-by-condition-with-data-series-node/4789>\
**Category:** Help\
**Tags:** workflow\
**Created:** [October 28, 2022, 3:39pm UTC](https://forums.losant.com/t/query-by-condition-with-data-series-node/4789 "2022-10-28T15:39:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Calderon](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jonathan\_Calderon](https://forums.losant.com/u/Jonathan_Calderon)\
**Post date:** [October 28, 2022, 3:39pm UTC](https://forums.losant.com/t/query-by-condition-with-data-series-node/4789/1 "2022-10-28T15:39:05Z")

</div>

Hello Losant Team

is it possible with a data Series Node get all registers by a condition “greater than”?

For example in SQL i would do something like this:  
SELECT \*  
FROM SpecificDevices D  
WHERE customValue \> D.value

CustomValue is a value that i set  
D.Value is a specific value from a specific device

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![Sebastian\_Turner](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/sebastian_turner/32/4024_2.png) [@Sebastian\_Turner](https://forums.losant.com/u/Sebastian_Turner)\
**Post date:** [October 28, 2022, 4:12pm UTC](https://forums.losant.com/t/query-by-condition-with-data-series-node/4789/2 "2022-10-28T16:12:25Z")

</div>

Hi @Jonathan_Calderon!

You can query devices by device tag values ([link](https://docs.losant.com/devices/device-queries/#querying-by-device-tags)), but only by equal (`===`) or not equal (`!===`). No other logical operators are currently supported for device queries.

We’re currently evaluating ways to support this functionality on our platform.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Calderon](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jonathan\_Calderon](https://forums.losant.com/u/Jonathan_Calderon)\
**Post date:** [October 28, 2022, 5:44pm UTC](https://forums.losant.com/t/query-by-condition-with-data-series-node/4789/3 "2022-10-28T17:44:56Z")

</div>

Hi Sebastian  
Don’t worry about the devices. I have a list of devices and I will get data from them using a loop. My question goes to the WHERE.  
Let me clarify. I have two attributes and i want to use one to do a condition like attribute1 \< {{value}} and if true i get attribute 2.

I think that in Mongo DB is like this

```auto
{
 $and:[
   "id": {"$eq": {{idDevice}} },
   "nameAttribute1": { "$gt": {{value}} }
]
}

```

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![Sebastian\_Turner](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/sebastian_turner/32/4024_2.png) [@Sebastian\_Turner](https://forums.losant.com/u/Sebastian_Turner)\
**Post date:** [October 28, 2022, 6:15pm UTC](https://forums.losant.com/t/query-by-condition-with-data-series-node/4789/4 "2022-10-28T18:15:07Z")

</div>

Just to clarify - what dashboard block are you referring to?

---

<div class="post-metadata">

**Author:** ![Jonathan\_Calderon](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jonathan\_Calderon](https://forums.losant.com/u/Jonathan_Calderon)\
**Post date:** [October 28, 2022, 6:24pm UTC](https://forums.losant.com/t/query-by-condition-with-data-series-node/4789/5 "2022-10-28T18:24:40Z")

</div>

Sebastian I’m so sorry! i was talking about this

![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/5/53ccfec597101c117459fe01a4bc98e3b05d0253.png)

I got confused and i want to say NODE. Sorry hahahahaha  
Now i edit all the errors, sorry!

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [October 28, 2022, 8:05pm UTC](https://forums.losant.com/t/query-by-condition-with-data-series-node/4789/6 "2022-10-28T20:05:33Z")

</div>

There is not a way to do it as a direct query, but with some extra work you should be able to get to the result set you are looking for.

Instead of using the [Data: Time Series Node](https://docs.losant.com/workflows/data/time-series/) (which will only allow you to query one attribute at a time), use the [Losant API Node](https://docs.losant.com/workflows/data/losant-api/) and the [Data: Time Series Query action](https://docs.losant.com/rest-api/data/#time-series-query). This will allow you to return multiple attributes in one request.

You can then use a [Function Node](https://docs.losant.com/workflows/logic/function/) (or a [Loop Node](https://docs.losant.com/workflows/logic/loop/) and a series of other nodes) to filter those points down to only the ones that match the condition you are describing - or to mutate those results to return different values based on your condition.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Calderon](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jonathan\_Calderon](https://forums.losant.com/u/Jonathan_Calderon)\
**Post date:** [October 31, 2022, 1:45pm UTC](https://forums.losant.com/t/query-by-condition-with-data-series-node/4789/7 "2022-10-31T13:45:06Z")

</div>

Hi @Dylan_Schuster  
I will try your solution!  
Thank you very much @Dylan_Schuster and @Sebastian_Turner
