Can I split a source file into multiple files based on record count?

Yes. It is possible to split a source file based on the maximum number of records you want in each file. You can use the Sequence Generator and Write to Multiple Files Option in your preferred file destination type to do this.

Create a dataflow as below. A default file path for the output file and the preferred batch size for files are provided as constants. An in-memory sequence generator starting with 0 and step size 1 increment for each record of the Expression object.

The Expression object creates a file path for each record of the source file using the formula shown below:

This formula adds a number at the end of the default output file path, such that the number changes each time the batch size surpasses.

For example, the default output file path is

.........\OrderDetails.xls

For the first 100 records, the NextVal is 0 to 99 and the file path evaluates to be:

.........\OrderDetails0.xls

For the next 100 records, the NextVal is 100 to 199 and the file path evaluates to be: ........\OrderDetails1.xls

And so on.

If we run the dataflow, multiple output files will be created in the same folder as the default output file path, each carrying records up to the batch size.

Last updated

© Copyright 2023, Astera Software