Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I need to find the status for the Parent ID considering all child ID. If any of of the Child is in Open status then parent Status should be Open else closed. And count of the total Open Parents. Below is the sample data.
Parent | Child | Depth | ChildStatus | ParentStatus |
1 | 1 | 1 | Open | |
2 | 2A | 3 | Closed | Closed |
2 | 2B | 3 | Closed | Closed |
2 | 2C | 3 | Closed | Closed |
3 | 3A | 2 | Closed | Open |
3 | 3B | 2 | Open | Open |
4 | 4 | 1 | Closed | |
5 | 5A | 4 | Closed | Open |
5 | 5B | 4 | Open | Open |
5 | 5C | 4 | Closed | Open |
5 | 5D | 4 | Open | Open |
The count of open parent will 2 as only Parent 3 and 5 have the Open status.
CountOfOpen Parent |
2 |
Thank You,
Md Irfan
Try
Count({<ChildStatus={Open}>} distinct Parent)