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
AND
owned_by tag === logged in user’s experience group (which is passed as a context variable).

image

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.

Thanks!
Julia

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.

Ex:
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'}}
{{/if}}
{{/match}}
{{/match}}

Which gives me only my GPS Device plotted on the graph.
34%20PM

Let me know how else I can help!
Julia

1 Like

Hey @Leo_Bach1,

I wanted to reach out and let you know that Advanced Queries are here!

You can also read more about the Platform Update if you’d like.

Thanks so much,
Heath

1 Like