Greetings. I’ve seen the Kanarra demo, looks great. But in this case I just want to simply be able to ‘click’ the devices on, say, a separate (or not) div or paragraph above or below the main {{page}} to ‘change’ the context experience data of the dashboard to the appropriate device
There are two configuration steps needed to toggle between a device’s context values on an experience page:
1. Create context links within the experience page HTML
Since you are adding these links to the device’s dashboard page, you won’t need to create a new workflow! The HTML link you configure will be the parameter you would like to set. For example, for a device dashboard with a context variable string, a set of page links might look like so:
As a quick tip, configuring for more than one parameter the link would be ?device=the_device_id&string=an_animal.
2. Configure device page dashboard context
Within your dashboard experience page, you will need to configure the dashboard context for your parameters using the {{request.query}} object. Continuing with the above example, the path would be {{request.query.string}}.
Ok Julia, some things : 1) I don’t have a separate device dashboard, like the Kanarra demo. I have only one ‘main’ page with a ‘layout’ associated with it. On the layout is where I’m putting the ‘sensors links’ you referenced, as shown here:
As you can see below, I have configured ctx variables in dashboard ‘X’ (let’s call it dashboard X) using these ‘hexID’ tags which each corresponds to each individual sensor:
And which shows as an option in the Experience page:
And is EXACTLY what I wanted/needed, so thank you. I think I can now safely add an additional title to my collection of Junior Associate Losant Developer, if y’all don’t mind
Ok, here’s the next hurdle: So far the ‘static’ values as shown above with their corresponding devices’ a href links have worked like a charm, but I want/need the actual pageData displayed values not to be those ‘static’ BE28C4736DD2 from above, but to be the devices’ tags or even a Data Table entry - not just for the current/selected pageData page/device (as shown in the last line of code) but for the ones on the h ref list on the previous lines. Basically, dynamic text values instead of ‘static’ ones…What would be the course of action or starting points for this (see below):
@anaptfox, Thanks. Actually, what I want is for the text part ( …>Sensor<… ) to be a CTX based on the "?string=x". Is that possible? The <a href= will not change (that will be input manually permanently (deviceID, for example) for any/all pages. What needs to change is the ‘text’ associated with that <a href= link regardless of pageData fetched. Does this make sense?
Could you give an example of when you would change the text or make the text dynamic? What decides if the text needs to change and when? If you could walk me through that, I can certicaly point you down the right path.
As you can see from above in my experience page, I have listed all the available devices on that top ‘div’ row and, in this case, the selected href ‘Fridge’ (which is the actual static/permanent ‘text’ which points to the actual deviceID href link ) shows the correct CTX’d page, stats, etc, as well as at the end of that ‘div’ row the 'Selected Device Name with the pageData.deviceID.name. But what I’m looking for is to make those static ‘nicknames’ Fridge | Freezer | Room | etc. text for each link a, say, attribute, Data Table entry or tag - haven’t figure out that yet, whichever makes more sense and is easier to implement. The idea is that customers could, then, change these nicknames from a Dashboard Input Control box (again, to be saved as an attribute or Data Table row/item update) so I don’t have to do it manually. Let me know if this makes it better to understand; I hope so!
@anaptfox sir, thank you - I took your advice and ‘tweak’ the approach a bit; instead of going for ‘tags’ (since I wasn’t too sure about which approach to go for, attribute, tag or data table), I decided to go for the Data Table entry since I already have the whole environment set up already for that. So, I ‘tweak’ the workflow for the rendering pages so that it goes and looks at the devices and bring their associated Data Table entries into a payload section called “deviceQueries” I can ‘track’ from in the experience page:
And you can see is working perfectly with those ‘nicknames’ on the ‘top div’ changed at the Data Table level (in this case, most in Spanish) which is exactly what I wanted:
But there is still one question I have. In order to do this, this is how I’m getting this done (which, I’m ok if that’s the case, since I will only do it ONCE per client, then they will dynamically change those ‘nicknames’ thru a Input Control Box/Data Table Update):
Question : How can I ‘automate’ the entry number in the {{pageData.device.devicesQuery.items.X.nickName}} so that I don’t have to manually figure out the exact sorting order (currently by Table Data entry ID)? Any other suggestions to the above, of course, I’m most delighted to hear!
@JuliaKempf 1st guidance, @Heath, your 3 lines of code, together with @anaptfox firsts suggestions and my ‘data table’ last minute decision and I got exactly what I needed - and saved me a TON of future coding. Thank you ALL, very happy with the support on this one!
Greetings again on this topic @Heath ! New question: how can I get the count of the loop items? For example, if two devices then 2, five well, then of course, 5 etc. ? Thanks,