GPS Block and/or logic


Currently it seems that the GPS block only supports OR logic for displaying devices.
I am trying to get this block (or one identical to it) to use AND logic to display devices.
I am trying to restrict the devices that show up on the block only to the devices that are “owned by a specific user experience group” which I am trying to do using a device tag which matches that of the logged in user.

The devices I am trying to show in this example are ones that match both criteria:

device_type tag === machine
owned_by tag === logged in user’s experience group (which is passed as a context variable).

Is there a simpler way to do this that I am missing?
Is there a way to change the logic from match either of the entered criteria to match all of the criteria?


Hi @Leo_Bach1,

Currently, the GPS History block is set to be only an OR statement, but I will create a feature request for this. I will also play around with the Handlebar helpers and see if I can find a way to limit further, and will also look for another way to accomplish this if that should fail.


1 Like

Thanks for your response, Julia.
It seems that the Device List Block, GPS History Block and the Data Table Block all use slightly different “filtering” methods… some uniformity in filtering capabilities might be helpful to your users.

IMHO the most elegant solution seems to be the way that the Data Tables Block handles gathering the information with a “Query” to select the data which gives the user the most control over the data to display:

GPS History has “Block Data” for selecting devices:

and Device Block has “Filtering” for restricting devices:

Maybe I’m missing some design decision reasoning that make sense from the Losant developer’s perspective but I just thought I’d mention this to you.


Hi @Leo_Bach1,

I was able to get an AND statement into the GPS History block, hopefully it will work for your use case!

I have two statements in my block currently, a device named GPS Device and a tag query for color=white.

Which gives me two points, one for my GPS Device and another for a Thermostat device.

However, I only want my GPS Device to be plotted, so I include an Advanced point configuration:

{{#match deviceTags.color 'white'}}
{{#match deviceId '5cc7600bc18655000992fb98'}}
{{#if isLastPoint}}
{{colorMarker '#8db319'}}
{{else if isFirstPoint}}
{{colorMarker '#ff261b'}}

Which gives me only my GPS Device plotted on the graph.

Let me know how else I can help!

1 Like