# How to use dashboard context in experience view?

**URL:** <https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828>\
**Category:** Help\
**Tags:** experience\
**Created:** [March 23, 2018, 2:35am UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828 "2018-03-23T02:35:17Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_lamborn](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@Tim\_lamborn](https://forums.losant.com/u/Tim_lamborn)\
**Post date:** [March 23, 2018, 2:35am UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/1 "2018-03-23T02:35:17Z")

</div>

Hi,

My dashboard context works perfectly as a Losant dashboard. However, when used as an experience view page, it does not seem to work. the URL is updated correctly in the browser bar when I click on my list of devices but the gauges always show attribute values for the default device.

In my device list on the dashboard I have the URL as: `https://app.losant.com/dashboards/5aa5ecbcf45edf00075f9488?ctx[deviceId-0]={{deviceId}}` which works correctly. But when the URL is:  
`https://pmyexperience.onlosant.com/testdashboard?ctx[deviceId-0]={{deviceId}}`  
it does not seem to work.

Ideas?

---

<div class="post-metadata">

**Author:** ![Erin\_Thompson](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/erin_thompson/32/501_2.png) [@Erin\_Thompson](https://forums.losant.com/u/Erin_Thompson)\
**Post date:** [March 23, 2018, 3:11pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/2 "2018-03-23T15:11:14Z")

</div>

Hi,  
The context variable for experience views do not work the same as in dashboards, you’re going to have to pass path parameters down to the context variables.

Let’s start from the beginning. I’ll assume you have made a route called `/testdashboard`. You’ll need to add a path parameter like `/testdashboard/{deviceId}` or if you want it to be optional `/testdashboard/{?deviceId}` to your [endpoint](https://docs.losant.com/experiences/endpoints/). Then in your workflow, for this page, you will need to pass that parameter through to your view on the [Endpont Reply Node](https://docs.losant.com/workflows/outputs/endpoint-reply/). For this example, if you to make a custom json object to return as the page data then your json template would look like `{ "deviceId": {{ data.params.deviceId }} }`. Then in your [views](https://docs.losant.com/experiences/views/) dashboard, you will want to set your context variable of `deviceId-0` to `{{ pageData.deviceId }}`.

Hope this helps,  
Erin

---

<div class="post-metadata">

**Author:** ![Tim\_lamborn](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@Tim\_lamborn](https://forums.losant.com/u/Tim_lamborn)\
**Post date:** [March 27, 2018, 12:15am UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/3 "2018-03-27T00:15:07Z")

</div>

Thanks Erin,

Understood… Just one more question, That would suggest that in my dashboard where I have my device list control that I click on a device to customise the dashboard, the device list URL would be …/testdashboard/?ctx[deviceId-0]={{deviceId}}&ctx[string-0]={{ valueByKey deviceTags ‘Site’ ‘key’ ‘value’ }}.

That would mean that my dashboard context would no longer work outside the user experience page? Ie just as a normal losant dashboard?

---

<div class="post-metadata">

**Author:** ![Erin\_Thompson](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/erin_thompson/32/501_2.png) [@Erin\_Thompson](https://forums.losant.com/u/Erin_Thompson)\
**Post date:** [March 27, 2018, 1:56pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/4 "2018-03-27T13:56:20Z")

</div>

That is a great point, one that I have actually never thought of before but you will have to choose which URL to use on the dashboard. My suggestion would be if you want to display the dashboard on the experience page, or if you want people to view the dashboard on Losant. If you want it on the experience page then use the experience pages URL otherwise use the one we discussed earlier.

We will try to figure out an easy way to allow you to switch back in forth between URLs like this, but currently, we do not have a helper that does what you are asking.

Thanks,  
Erin

---

<div class="post-metadata">

**Author:** ![WoobaGooba](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/woobagooba/32/507_2.png) [@WoobaGooba](https://forums.losant.com/u/WoobaGooba)\
**Post date:** [December 14, 2018, 5:07am UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/5 "2018-12-14T05:07:45Z")

</div>

I’m hitting this issue as well. Device List Block works fine as Losant Dashboard but will not operate correctly as an experience view. If I am reading this thread correctly, there is no way to code a device list block such that it will operate correctly both as a Losant Dashboard or from within an experience view?

I am stumped with this situation. How practically can a dashboard be developed using Losant dashboard and also deployed to an experience view?

---

<div class="post-metadata">

**Author:** ![Hugo\_Hernan\_Ruiz](https://avatars.discourse-cdn.com/v4/letter/h/50afbb/32.png) [@Hugo\_Hernan\_Ruiz](https://forums.losant.com/u/Hugo_Hernan_Ruiz)\
**Post date:** [March 22, 2019, 2:07pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/6 "2019-03-22T14:07:11Z")

</div>

Hello! Please I need your help. I’m trying to do this, but I can’t get the dashboard take the new parameter for change the device … where does the dashboard take the new parameter into the context variable? I can only select the devices that I have created but will not let me reference {{pageData.deviceId}} I really sorry, maybe it’s easy but for me it’s not evident…

Thank you!

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

---

<div class="post-metadata">

**Author:** ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)\
**Post date:** [March 22, 2019, 2:41pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/7 "2019-03-22T14:41:35Z")

</div>

Hello,

This text input can be a bit tricky, if you have typed the name, also check that you are clicking on the value that comes up, as you must select it as well. Here is how it will appear when correctly selected:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/7/79fe3ea578bafce0c203197498e9aeac55e0e749.png)

If you are still unable to reference the deviceId, let me know and we will look again!

Thanks,  
Julia

---

<div class="post-metadata">

**Author:** ![Hugo\_Hernan\_Ruiz](https://avatars.discourse-cdn.com/v4/letter/h/50afbb/32.png) [@Hugo\_Hernan\_Ruiz](https://forums.losant.com/u/Hugo_Hernan_Ruiz)\
**Post date:** [March 22, 2019, 2:51pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/8 "2019-03-22T14:51:08Z")

</div>

Thks! works! your help is wonderful!

---

<div class="post-metadata">

**Author:** ![Leo\_Bach1](https://avatars.discourse-cdn.com/v4/letter/l/ad7895/32.png) [@Leo\_Bach1](https://forums.losant.com/u/Leo_Bach1)\
**Post date:** [May 6, 2019, 1:16pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/9 "2019-05-06T13:16:12Z")

</div>

So it seems this thread is very similar to the issue I am currently trying to work through:  
On our custom URL the user can create a machine and select it to see all the sensors that are on that machine:

This is the /machines page/endpoint… a dashboard which lists all the devices (that have a deviceTag companyName=logged in user’s company + have a deviceTag deviceType=machines).

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/c/c1f6a33cc350598643b7b057585d2b1264d25f26.png)  
This link is putting the correct deviceId into the URL for the next page… but when I get to the /machine/{deviceId?} page it seems that the context information isn’t updated from the default selection to the information in the URL. Notice the URL has the “machineId” to get set to the deviceId of the device that was clicked in the device list block from the previous page (/machines)… but the context that is set in the new dashboard (/machines/{deviceId?}) does not reflect the context that I have passed in :  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/2/25b3a5002138579f9e83e4de71cc08e088451d4e.png)

FYI is how I have configured the endpoint:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/3/33a081b4a398ce203ffc07659affcb92f0568df2.png)

The device information that is in the URL points to a device with a name of “Machine\_B” once updated from the default of “testunit”.  
See default set here:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/1/10154b7dfe41044a9aac307e6b5906c69a5f2beb.png)

No matter where the context variable is called within the dashboard it does not update to the selected device (the one selected from the previous device list block).

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/3/38efa12cc78c7156fd9f9ae30138fdb49e703260.png)

Notice how the context variable for machineId-0 is set in the URL but the place where this variable is called within the dashboard (in the block header box) does not update from the default “testunit” to the newly passed context of “Machine\_B”.

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

Although I’ve been given access to the multi-tenant example this part isn’t very useful because I cannot see how the device blocks or context variables are set up.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/e/e5ae9ccc8536df130a84c30f577ae3773015db7a.jpeg)

---

<div class="post-metadata">

**Author:** ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)\
**Post date:** [May 6, 2019, 4:11pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/10 "2019-05-06T16:11:14Z")

</div>

Hi Leo!

The URLs are set a bit differently in the Multi-Tenant example, I will give you access to see the dashboard block configuration. The endpoint for the deviceID path is named as `/device/{deviceId}`:

 ![34%20PM](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/7/7f9952041eceb3882868153fc2cf2ca5074feba9.png)

The URL for the deviceId is with `{{deviceId}}`:

 ![59%20AM](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/f/fd9b7d18ea008fd90ef02aa634fda7cb5e3c1e1e.png)

I believe these changes may solve the context not being updated, but please let me know if not and we will look again!  
Thanks,  
Julia

---

<div class="post-metadata">

**Author:** ![Leo\_Bach1](https://avatars.discourse-cdn.com/v4/letter/l/ad7895/32.png) [@Leo\_Bach1](https://forums.losant.com/u/Leo_Bach1)\
**Post date:** [May 6, 2019, 4:37pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/11 "2019-05-06T16:37:32Z")

</div>

Dashboard configuration access for the muli-tenant example would be very helpful.

---

<div class="post-metadata">

**Author:** ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)\
**Post date:** [May 6, 2019, 6:02pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/12 "2019-05-06T18:02:51Z")

</div>

Hi Leo,

I cloned the “Your Devices” dashboard and gave you full permissions. Feel free to play around and change things, it is a clone!

Thanks,  
Julia

---

<div class="post-metadata">

**Author:** ![Leo\_Bach1](https://avatars.discourse-cdn.com/v4/letter/l/ad7895/32.png) [@Leo\_Bach1](https://forums.losant.com/u/Leo_Bach1)\
**Post date:** [May 6, 2019, 6:11pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/13 "2019-05-06T18:11:27Z")

</div>

Can you clone the “device details” dashboard as well so I can make sure I’m passing the data correctly on that side as well?

---

<div class="post-metadata">

**Author:** ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)\
**Post date:** [May 6, 2019, 6:16pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/14 "2019-05-06T18:16:45Z")

</div>

Done! Let me know if you have any questions 😄

Julia

---

<div class="post-metadata">

**Author:** ![Leo\_Bach1](https://avatars.discourse-cdn.com/v4/letter/l/ad7895/32.png) [@Leo\_Bach1](https://forums.losant.com/u/Leo_Bach1)\
**Post date:** [May 6, 2019, 6:57pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/15 "2019-05-06T18:57:38Z")

</div>

I’m still struggling for some reason… when I pass the data from one dashboard to the next using the deviceId it still shows the default regardless of which deviceId that shows in the URL.

I’ve tried to copy the example exactly but there must be something that I’m missing.

Even when I change the context name (which I didn’t think could be an issue) the dashboard still shows the old context variable.

Renamed to just deviceId:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/1/10292bcaa5931399f44184c2e99f667487eeb61c.png)

Still shows the old context variable under the dashboard:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/7/790ef9876b20c2dc1444b471f15c3425187344cd.png)

---

<div class="post-metadata">

**Author:** ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)\
**Post date:** [May 6, 2019, 8:04pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/16 "2019-05-06T20:04:18Z")

</div>

Hi Leo!

I took a look at your experience to see if I could locate the culprit. 😀

The `{{ctx.machineId-0.name}}` you are seeing under `Selected Machine` is the user-defined description that was set for the dashboard, so fear not! Your context names are successfully being updated. You can locate and change the description by clicking on `Edit Settings` on the dashboard page.

I was also able to locate a slight difference between the Multi-Tenant Example and your application that could be the problem. It looks as though the Dashboard Context on your Machine Page has not been set for `{{ctx.deviceId}}`. This seems to be what is setting the Device ID in the Multi-Tenant Example, allowing the user to see data based on the device they selected!

 ![37%20PM](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/7/7c0a7d25a124b77aaaf7698dac861efcecd45d1c.png) ![46%20PM](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/4/48078fdae7dc7123c7d0f227b4a90d18e74ac6a4.png)

I will continue to look into this and see if I can find anything else that could be preventing you from setting the context.

Thanks!  
Julia

---

<div class="post-metadata">

**Author:** ![Leo\_Bach1](https://avatars.discourse-cdn.com/v4/letter/l/ad7895/32.png) [@Leo\_Bach1](https://forums.losant.com/u/Leo_Bach1)\
**Post date:** [May 6, 2019, 8:09pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/17 "2019-05-06T20:09:56Z")

</div>

So maybe I am the only one that is confused by this… but why are there two places for setting the dashboard context? You can set it both through the dashboard itself (in the top right corner) and through the Experience Page (at the bottom of the form)… do they do different things within Losant or are there just 2 places to perform the same task?

---

<div class="post-metadata">

**Author:** ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)\
**Post date:** [May 6, 2019, 8:45pm UTC](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/18 "2019-05-06T20:45:18Z")

</div>

Great question! Dashboard context can be set on the dashboard page itself, but when used in an experience, the data is essentially “passed” to the page. Experience pages that display dashboards do not show configuration options like the regular dashboard, so your context cannot be set from the experience page itself:

 ![59%20PM](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/e/e1beb8f2a1206775cf972acecaa2197339b22acc.jpeg)  
 ![08%20PM](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/b/bce2bae2b099ef06ffbfd0ba108af7082d122434.jpeg)

We created Dashboard Context in the experience to allow for the Multi-Tenant setup, as it was not possible previously. If you wanted a user to have a custom dashboard based on a user group, you would have to make dashboards for each group, and create a page and workflow for each dashboard. Context is one of the more difficult parts of Losant to understand, so you are definitely not the only one!

Here are a couple more resources on context:

> **[Introducing Dashboard Context](https://www.losant.com/blog/platform-update-20170228)**
>
> Today's release gives you much more power over the configuration and runtime characteristics of your dashboards.

  

> **[Context Variables](https://docs.losant.com/dashboards/context-variables/)**
>
> Learn how to manipulate Losant dashboards by setting global context variables to control data queries and visualizations.

Thanks!  
Julia
