Some updates. I have solved 1) and 3) using the Reformat Component.
For 1), it is solved by using a if/else to detect “0” and “-” (it is not null, otherwise i will use isnull()) and changing the value.
For 3), it is to edit the metadata and changing the delimitator type from | to ,
I have attached an example graph, which loads some example data based on your inquiry. It contains the Normalizer component, which is set the way you want. The CTL code it contains is commented, for you to be able to easily understand what it does. Part of this code also replaces null values with 0 since there is no specialized component for this. Regarding the delimiter question: yes it can be easily changed via the metadata settings as depicted bellow.
I am unable to open your sample file. CloverETL says “Cannot open graph source editor” and details indicates that the Editor cannot initiate due to a null pointer exception in java. Had this issue before with other example files posted here in the forum.
I have couple of questions regarding your issue with opening the graph.
1. What version of the Designer are you using?
2. Do the graphs you have created yourself open normally?
3. Please provide me with the error log of the Designer, which is located in <your_workspace>/.metadata/.log
4. How did you import the file into the Designer (copy - paste method or standard import function of the Designer) ?
You need to have the file imported in the project, opening it while it’s not added to project will result into an error. However I admit the error message is not correct or understandable. I have created an issue in our bug tracker, for our developers to know about it. So please use some method to import the graph in order to be able to view it. You can right-click on the graph folder in the Navigator window and select import, or you can simply copy-paste the graph in.
I am having a similar challenge. I’m looking to collapse data in various columns into a single column and multiple rows. I think the normalizer can do this? Do you have an example graph for how to do this?
Incoming record (1 row): First Name, Last Name, State, Field1, Field2, Field3, Field4
outgoing record (4 rows) where the first three fields repeat and then fields 1-4 get put on separate rows:
First Name, Last Name, State, Field1
First Name, Last Name, State, Field2
First Name, Last Name, State, Field3
First Name, Last Name, State, Field4
Can the normalizer handle this? Does anyone have any example code?
Hi Pintail,
yes, Normalizer is the component you are looking for. Below, you can review an example code (in Normalizer) that is based on your sample data:
In the count function, I demonstrated a generic approach where you would simply put multiple fields into a single list field and return its index count to the transform function. If you knew that the number of fields being transformed to rows is always the same, you could return a hardcoded number by the count() function (for example: return 4;)
Consequently, the transform function runs 4 times and each time it writes a different field into the $out.0.Field based on the index number.
Best,