Welcome to the Smartsheet Forum Archives
The posts in this forum are no longer monitored for accuracy and their content may no longer be current. If there's a discussion here that interests you and you'd like to find (or create) a more current version, please Visit the Current Forums.
Identifying Main tasks & Sub tasks / Identifying last child nodes in hierarchy
Hi All,
I'm new to Smartsheet. I would like to know how could I get to know a task is a Main task or Sub task using Smartsheet APIs,
My requirement is to consider all the Subtasks (Child rows) in a smartsheet for some calculation purpose.
When I see a smartsheet, I can do indentation and I can recognise which is Main task and which is Subtask. How do I do the same using APIs?
Please suggest if you have any idea on identifying Sub task.
Thanks
Sanjay.S
Comments
-
With the Smartsheet API, the fact that a row is a child row of another row is indicated by the presence of the parentId attribute on the Row object. If present, that property on a Row object specifies the value of the parent row’s Id.
- If the parentId attribute is null (or not present) on a Row object in a response, this indicates that the Row is a top-level row (i.e., is not a child of any other row).
- If the parentId attribute of a Row object is not null, this indicates that the Row is a child of the row that has Id corresponding to the parentId value.
-
Dear Kim Brandl, Thanks for your reply.
Based on your reply I understand that we can identify a task as Main task or not.
But as a Smartsheet User, I can add multiple levels of Subtasks. In that case how do I Identify & pick the least level of Child node programatically? With every row I can get whether there is a parentID associated with it or not. In similar way can I get whether a child and childID is associated with it or not?
Rephrasing the question in other way, how do I get a list of all rows for which no further nesting/child nodes available.?
Thanks & Regards
Sanjay.S
-
You'll need to use parentId (as previously described) to derive row hierarchy within the Sheet. i.e., execute a "Get Sheet" request, then iterate through the rows in the response, using the parentId attribute to derive row hierarchy (i.e., which rows are "sub tasks" of other rows).
-
Relatedly: Is there any way to build a filter or a formula that can identify the parent/child? I want to run a filter that omits child rows and right now I'm using a manual hack by creating a column in which I manually note the hierarchy. I would prefer it to be formulaic. An ideas or tips?
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 439 Global Discussions
- 138 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives