Using the Collapsible Tree Template on Device Tags

Hello Losant support:

I am attempting to include the Collapsible Tree Component Template in my experience pages to allow for device breakdown based on the device tags. I have decided to attempt this approach vs utilizing experience groups due to the amount of permutations required for our device network. The desired menu would look something like this:

-> myParentDeviceTag1
-> myParentDeviceTag2
and so on…

I believe the Collapsible Tree Component Template can do this, but I am struggling to get the device tags organized into a parent / child list (similar to the output of the Group: Summary Node). Can you provide some guidance on how I may achieve a parent/child list based on the desired device tags?

Hey Mike,

This is possible but is a little more advanced. You would have to use the Function Node to build up the data structure of your list of devices to look like this:

"groupTreeResult": {
      "name": "(root)",
      "id": "(root)",
      "children": [
          "name": "Top Parent",
          "id": "58dc4ec29e8df60001fbea01",
          "children": [ ... ]
          "name": "Top Parent 2",
          "id": "58dc4ec29e8df60001fbea02"

Or, you can customize the properties the template is looking for using Arguments.

Since Losant doesn’t have a built-in way to relate parent and child tags, would you be able to tell me more about how you are defining that?

Thank you,

Thanks for the response Heath!

I think I can work with the function node on this. If I am understanding right, it sounds like I should loop through all devices and then reference the appropriate tags as I write the intended output in the parent child relationship. As far as how we are defining that, I’ll attempt an abstract explanation here.

We have added a data table that outputs from our ERP system and defines both user tags and device tags. I’ve decided to limit the amount of experience groups as the permutations would become numerous. As a device is provisioned, it is assigned an identifier that matches that from our ERP system. We have a workflow that runs on a scheduled and as-needed basis to assign the appropriate tags from our ERP system onto the device (and user - separately).

The desired user experience here is one where the user can define how to best organize their device suite. For example, a sales user could organize by:

-> Territory
–>Sales Representative
—> Account
----> Device type
-----> Device

Or, likewise, a corporate user could decide to organize by:

-> Market Segment
→ Brand Category
—> Parent Account Group
----> Location
-----> Device Type
-------> Device

From here, I believe I can return a single deviceId or array of deviceIds to apply to a context variable for the resulting dashboards.

If I can write the parent child relationship on the fly, this should be possible. Do you think this approach will work?

If so, do you think that the loop is the best method to incorporate with the function? And, if the loop is appropriate, I may need some guidance on how to find whether the parent value has been written and then add the appropriate children to that parent.

Hey Mike,

I’m going to take this off the forums, as I have some questions that are pertinent to your application.

Look for an email from me shortly!

Thank you,