have data table with hierarchy data model with tree structures. For example: Here is a sample data row:
-------------------------------------------
Id | name |parentId | path | depth
-------------------------------------------
55 | Canada | null | null | 0
77 | Ontario | 55 | /55 | 1
100| Toronto | 77 | /55/77 | 2
104| Brampton| 100 | /55/77/100 | 3
I am looking to convert those rows into flattening version, sample output would be:
-------------------------------------------------------
Id | name |parentId | path | depth | pathNames
-------------------------------------------------------
55 | Canada | null | null | 0 . | None
77 | Ontario | 55 | /55 | 1 . | Canada
100| Toronto | 77 | /55/77 | 2 . | Canada, Ontario
104| Brampton| 100 | /55/77/100 | 3 . | Canada, Ontario, Toronto
To simply how the PathFullNames is generated, it comes from the same table matching on the ids from the path. So in the above example /55/77/100 is equal to /Canada/Ontario/Toronto
Hope that makes sense.
pathNamescome from (i.e. looked up byId) rather than making the reader figure this out for themselves.