Data Manipulation

Hi,

I have an FTP connection that I would like to modify. The current sheet has 3 columns consisting of the SKU, warehouse number, and inventory level. Sadly the data is returned such as:

0010041 002 0000032
0010041 003 0000044
0010041 004 0000072
0010041 005 0000035
0010041 006 0000008
0010041 007 0000056
0010041 008 0000031
0010041 009 0000036

Is there a way to modify it to group by SKU and return the data back as:

SKU DIVISION 002 DIVISION 003 DIVISION 004 DIVISION 005 DIVISION 006 DIVISION 007 DIVISION 008 DIVISION 009
0010041 0000032 0000044 0000072 0000035 0000008 0000056 0000031 0000036

Thank You

5301043caa20740200000001-a2c18d51df234e528c6c32dfa8060dd0.png

@joseph910 you would need grouping on your export to group by the sku and then a transform script to flatten out your structure. You can use Celigo AI to build the script out for you.

/*
* transformFunction stub:
*
* The name of the function can be changed to anything you like.
*
* The function will be passed one 'options' argument that has the following fields:
* 'record' - object {} or array [] depending on the data source.
* 'settings' - all custom settings in scope for the transform currently running.
* The function needs to return the transformed record.
* Throwing an exception will return an error for the record.
*/
function transform(options) {
const transformedRecord = {};
options.record.forEach((item) => {
transformedRecord.sku = item.Column0;
transformedRecord[`division${item.Column1}`] = item.Column2;
});
return transformedRecord;
}