Hi there,
short Question regarding the Normalizer:
My records are like:
Week1 | Week2 | Week3
Store1 1000 | 1300 | 900
Store2 800 | 700 | 1100
Store3 1400 | 1200 | 1500
And I would like to transform it like this:
Store1 | Week 1 | 1000
Store1 | Week 2 | 1300
Store1 | Week 3 | 900
Store2 | Week 1 | 800
Store2 | Week 2 | 700
Store2 | Week 3 | 1100
Store3 | Week 1 | 1400
Store3 | Week 2 | 1200
Store3 | Week 3 | 1500
I know how to get the numbers into the rows. But how can I get the labels of my records into the rows of my output?
regards
Peter
short Question regarding the Normalizer:
My records are like:
Week1 | Week2 | Week3
Store1 1000 | 1300 | 900
Store2 800 | 700 | 1100
Store3 1400 | 1200 | 1500
And I would like to transform it like this:
Store1 | Week 1 | 1000
Store1 | Week 2 | 1300
Store1 | Week 3 | 900
Store2 | Week 1 | 800
Store2 | Week 2 | 700
Store2 | Week 3 | 1100
Store3 | Week 1 | 1400
Store3 | Week 2 | 1200
Store3 | Week 3 | 1500
I know how to get the numbers into the rows. But how can I get the labels of my records into the rows of my output?
regards
Peter
-
Hi Peter,
I have attached a sample solution to your data challenge. Worth noting are these component settings:- FlatFileReader: Trim Strings = true (to remove redundant space characters);
- 'input' metadata: when extracting metadata, Extract Names = true (to get the actual metadata field names instead of generic Field[index] names);
- Reformat: using the split() function to parse the first field containing mixed information;
- Normalizer: using the getFieldName() function to push the metadata field name as an output record;
Kind regards,
Vladi -
Thank you Vladimir, that helps a lot! -
Hello Gents,
I like to add 'another' way of solution with Rollup component.
* in Clover is pretty usual to archive the goal in many ways.
Vladi solution (what is just simple and perfect) also in the attached Graph, i add SimpleCopy to feed the additional Rollup component.
Note: Rollup a little bit more complex component than Normalizer, but i think in this case may a nice introduction the Rollup also.
I also add additional input file for demo, where 5 Week exist.
The code itself works any column amount => its get the field count in length($in.0) part. And i expect, the 'Weeks' start in the 2nd 'column/field' in the data.
Regards: Andras,
Forum member -
Hi Andras,
thank you for the elaborated example. We really appreaciate your contribution to this topic, especially because of the complexity of using RollUp.
Best regards,
Vladi -
Thanks! Actually forum cases helps me to improve my Clover skills :)
Regards: Andras,
Please sign in to leave a comment.
Comments 5