Is it possible to use the logged in User Group as a filter for a tag in Device List Block

experience
#1

I have a user which will login to a webpage and that user will have an assigned userGroup.I also have devices which are “owned by” that user group (a device tag called “machineOwnerGroup” with a value of the userGroup.0.id which “owns” that device).
I’d like to use the Device List Block to list all of the devices which have the tag “machineOwnerGroup” to match the current logged in user’s userGroup.0.id.

Is this possible? Am I going about this the wrong way?

Here is the context that was set for the dashboard:

0 Likes

#2

Hi @Leo_Bach,

I’m going to build out an example to see if I can locate the problem, and will get back to you with a further solution. I think the default value for the userGroup tag needs to be formatted differently, but I am going to test to be certain.

Thanks!
Julia

1 Like

#3

Do you use Skype? My Skype Profile

It might be easier and quicker to show you what I am doing.
I bet you’ll see the breakdown quickly based on your extensive experience.
If not, no worries I’d just feel bad about asking you questions that are likely answered by the documentation somewhere and I am just missing a small detail or am accessing the page context incorrectly.

0 Likes

#4

Hi Leo,

Not to worry, it’s quite fun to work through these problems! I think I have a solution, but if this does not solve it, I would be more than happy to Skype and walk through it. :smile:

I checked out the Multi-Tenant Example (https://5c18137f16f0bb0008525d90.onlosant.com) and how it is set up. There are user groups set up in this example, one is called “kanarra” and another is called “airbus”. The dashboard context for “group” is set by the logged in user’s group. This is set on the Experience Page, as group={{ experience.user.experienceGroups.[0].name}}:

Over on the dashboard page, we have {{ctx.group}}:

This will be set to the group of the logged in user, and will look like such when an “airbus” tagged user logs in:

Let me know if this helps!
Julia

0 Likes

#5

Haha… I see part of my problem…
I wasn’t selecting item 0 from the pageData correctly… selecting from a list requires brackets.
Ugh… it’s been a long day :sweat_smile:.

I will try correct formatting and see if I get further.

Much appreciated.

-Leo

1 Like

#6

Can you show the setup of the device list block for this instance?

How does the device list block know to show only devices with a tag matching the logged in user?

0 Likes

#7

The Device List is set up as such:

The link takes you to a page for each individual device. :smile:

0 Likes

#8

Do you have a few minutes to Skype today? I’m not sure if my mistake is in my experience workflow or if it is on the dashboard itself. I have a feeling that I am making a mistake on the way I am replying to the GET request to get the appropriate context passed into the dashboard.

1 Like

#9

Hi @Leo_Bach1,

Just an update, a hot fix went out for the Experience Page bug. Thank you for your patience and for locating this! :bug:

Julia

0 Likes