Hi eveyone !
I am searching for a while now to create a simple recursive traitment from a CSV file that I have.
Here is my setup:
1) I have a CSV file that contains a list of sections, each having multiple children. The relation is set thanks to a field "ParentLevel" that indicates, for every children, which parent it has.
The child has its own field "CurrentLevel" that can appear in another entry as a parent.
That way, it creates a tree with unique parents having multiple children.
Its template is the following :
ParentLevel ; CurrentLevel ; Name
What I am trying to achieve is the following :
I am trying to recreate the entire tree from the CSV file, with the following transform (can't upload picture so i will explain)
I read the csv file, use a "Closure Generator" to get the distance between every parent and child. From there, I sort on CurrentLevel and filter the rows on ParentLevel that are equals to "ROOT".
From here, I can clone the rows by the distance the closure generator gave me (minus 1 with a modified java value), it gives me the following ouput :
-----------------------------------
ParentLevel = ROOT
CurrentLevel = 997715
Distance = 3
CloneNumber = 0
-----------------------------------
ParentLevel = ROOT
CurrentLevel = 997715
Distance = 3
CloneNumber = 1
-----------------------------------
ParentLevel = ROOT
CurrentLevel = 997715
Distance = 3
CloneNumber = 2
-----------------------------------
What I need to do, is to get the levels between ROOT and 997715, like this :
-----------------------------------
CurrentLevel = 997715
ParentLevel = 2103361
-----------------------------------
CurrentLevel = 2103361
ParentLevel = 123
-----------------------------------
CurrentLevel = 123
ParentLevel = ROOT
-----------------------------------
I tried to filter on the "distance" value and decrement it, get the parent from the child and loop, but pentaho will not allow it. (Loops are not allowed!)
I am using Pentaho Data Integration 5.1.0.
If anyone has a clue of how to do it, I'm all ears! In the mean time, I'll try to work something out and let you know if I find anything.
Thank you for your time !
Cheers,
François.