G
Gustaf
I got a sheet with products, having ProdNo, Name and so on. The sheet is created from another application, and uses ". " in ProdNo to symbolize one level of indendation, like so:
ABC001
.. ABC002
.. . ABC003
.. . ABC004
.. ABC005
In this hierarchy ABC0001 contains 2 products and ABC002 contains 2 products. My task is to
1. Replace each ". " with an indent.
2. Sort each substructure.
3. Remove any duplicates.
The number of levels is unknown, so these tasks needs to be done recursively.
I'm not sure what approach to take. On one hand, I want an OOP approach, so I can have a row object that "knows" about its children, so I can sort one level without worrying about sub-levels. On the other hand, that probably means I have to store the whole tree in memory, which would be slow and costly. Any hints?
Gustaf
ABC001
.. ABC002
.. . ABC003
.. . ABC004
.. ABC005
In this hierarchy ABC0001 contains 2 products and ABC002 contains 2 products. My task is to
1. Replace each ". " with an indent.
2. Sort each substructure.
3. Remove any duplicates.
The number of levels is unknown, so these tasks needs to be done recursively.
I'm not sure what approach to take. On one hand, I want an OOP approach, so I can have a row object that "knows" about its children, so I can sort one level without worrying about sub-levels. On the other hand, that probably means I have to store the whole tree in memory, which would be slow and costly. Any hints?
Gustaf