Hi,
I am trying to use CloverETL to transfrom my source file into a OIA (oracle identity analytics, erstwhile Sun Role Manager V 5.0.3) desirable import format. However, I am unable to join multiple rows from source file to one row.
Here is the process I am following :
1. Get the source file
2. Partition it into 2 different files
3. Create a single row for every join_key in above files with all selected data being joined in double quotes with comma separation.
Exampel :
Source File -
A1234 , XYZ, name1, subject1, 1
A1234 , ABC, name1, subject1, 1
A1234 , CDE, name1, subject1, 0
A1234 , FGH, name1, subject1, 0
Desired Ourput - 2 files
File 1 : A1234, “XYZ,ABC”, name1, subject1
File 2 : A1234, “CDE,FGH”, name1, subject1
Thanks,
Hello,
for joining data from one stream use Denoramlizer component with following code:
//#TL
// This transformation defines the way in which multiple input records
// (with the same key) are denormalized into one output record.
string data = '"';
// This function is called for each input record from a group of records
// with the same key.
function append() {
data = concat(data, $field2, ',');
}
// This function is called once after the append() function was called for all records
// of a group of input records defined by the key.
// It creates a single output record for the whole group.
function transform() {
$field1 := $field1;
$field2 := concat(substring(data,0,length(data) - 1),'"');
$field3 := $field3;
$field4 := $field4;
return OK
}
// Called after transform() to return the resources that have been used to their initial state
// so that next group of records with different key may be parsed.
function clean() {
data = '"';
}
To partition output data to different files, set partitionKey attribute on DataWriter. You can specify the place of partition tag in file url, eg: ${DATAOUT_DIR}/file#.txt