Query by condition with Data Series Node

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 :slight_smile:

Hi @Jonathan_Calderon!

You can query devices by device tag values (link), 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.

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

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

Thanks :slight_smile:

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

1 Like

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

image

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

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 (which will only allow you to query one attribute at a time), use the Losant API Node and the Data: Time Series Query action. This will allow you to return multiple attributes in one request.

You can then use a Function Node (or a Loop Node 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.

1 Like

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