What I actually want to do is map an SDMX-document (XML, tree-structure) onto a table / list of rows and then feed it to a database.
I read the SDMX-document using the "XML Input Stream" step which leads to list of rows representing the atoms of the document which I now have to rearrange. So let's assume a simplified tree structure like this:
Clipboard02.gif
With X and V being the type of the value or the name of the dimension (like city for X and population for V - ignoring necessary time dimension).
And the list of rows looks something like this - coming from the XML input Stream and using a few steps in between (Table 1):
KEY | VALUE
------------
X | A
V | 1
V | 2
V | 3
X | B
V | 1.3
V | 2.3
V | 3.3
The final row structure I would like to achieve looks like this (Table 2):
X | V
-------
A | 1
A | 2
A | 3
B | 1.3
B | 2.3
B | 3.3
As Kettle is walking through all the rows from start to finish (Table 1) my idea is to store the last value of X and and use it as a value in the finally produced row (Table 2).
But so far none of the ideas worked out.
For example I tried a switch/case on X/V for KEY - so as soon as KEY = X a variable is set to its VALUE and when KEY = V then the variable is used for column X.
Clipboard05.gif
How can I accomplish this feat in Kettle?
Thanks in advance
Raffael
I read the SDMX-document using the "XML Input Stream" step which leads to list of rows representing the atoms of the document which I now have to rearrange. So let's assume a simplified tree structure like this:
Clipboard02.gif
With X and V being the type of the value or the name of the dimension (like city for X and population for V - ignoring necessary time dimension).
And the list of rows looks something like this - coming from the XML input Stream and using a few steps in between (Table 1):
KEY | VALUE
------------
X | A
V | 1
V | 2
V | 3
X | B
V | 1.3
V | 2.3
V | 3.3
The final row structure I would like to achieve looks like this (Table 2):
X | V
-------
A | 1
A | 2
A | 3
B | 1.3
B | 2.3
B | 3.3
As Kettle is walking through all the rows from start to finish (Table 1) my idea is to store the last value of X and and use it as a value in the finally produced row (Table 2).
But so far none of the ideas worked out.
For example I tried a switch/case on X/V for KEY - so as soon as KEY = X a variable is set to its VALUE and when KEY = V then the variable is used for column X.
Clipboard05.gif
How can I accomplish this feat in Kettle?
Thanks in advance
Raffael