[Javascript]Row Delimiter & Field Separator

This recipe demonstrates how to implement Row Delimiter/Field Separator using JavaScript in a composite datasource.

Steps taken:

  1. Create a composite datasource (test(t).ds). Drag and drop the tabular datasource (test.ds) as the beginning of the flow.
  2. Add a “Processor” element following the tabular datasource. Select “General > JavaScript”. Enter the following script in the “processRecord” tab page:var tokens = test.split("@@");for ( x in tokens)
    {
    var out = this.newRecordInstance();
    var outData = out.getData();
    outData[0] = tokens[x];
    next.processRecord(out);
    }
  3. Add another “Processor” element following the tabular datasource. Select “General > JavaScript”. Enter the following script into the “processRecord” tab page:var tokens = test.split("||");{
    var out = this.newRecordInstance();
    var outData = out.getData();
    outData[0] = tokens[0];
    outData[1] = tokens[1];
    next.processRecord(out);
    }

To download the necessary files for this recipe, refer to the attached ZIP package.
Sample2 (2).zip