Get All Group Descendants Property Possibility?



I believe you use the nested sets approach for your hierarchy data.  It sure would be simple for you to return the descendants of a particular group. 

Is it worth submitting a feature request to add a method for this?  Will it get shot down? I understand you can build it using the children property but for a project I have I would have to check this multiple times because you never know when a customer's group structure changes (like providing a drop down box in a tree-type structure for drill down in to groups).  In order to provide up-to-date data you would have to query the group structure a lot looking for changes for every request to the page/form (if I was to store the group structure in another database).

It sure would be nice to add a property on the GroupSearch object called "descendants" where you submit the id of the group to start at.  If you are using nested sets, it would be a quick call for you.

Kind of like you have for devices.  With DeviceSearch you can submit a group id for the groups property and get all vehicles at that level or below in the tree structure.



Michael Head

Please sign in to leave a comment.



Hi Michael,

You could try to submit a feature request, but I don't think it's likely to get implemented.

Since we use the API for the MyGeotab application we had to consider that the Groups would need to be queried often and took this into consideration when designing the API. We implemented the API so querying groups is very efficient on the server. Efficiency is also helped because of our "building block" approach to entities, which makes even a very large group structure a very small amount of data over the wire.

If it would be helpful maybe we could post some code samples (JavaScript) of common use cases for Groups...



Steve Hansen 0 votes

Thanks.  I know how to do it and build the structure.  For speed I was looking at storing the group structure the supplying the application with the tree structure at whatever point of entry the user had access to.  I just found that I needed to update the group structure throughout the day in case there was any changes.  The other option as you mention is to query all the groups (either from the user context or a higher privileged account) then build the structure then organize and display the tree structure. 


Just thought I would ask.  It would have helped with one of my steps.


Michael Head 0 votes