# 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. &#x20;

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.

<figure><img src="/files/kJtLU5qREPGYAsPOz5ky" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/pDnOVWJMr48FVpk7CN4O" alt=""><figcaption></figcaption></figure>

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. &#x20;

For example, the default output file path is&#x20;

.........\OrderDetails.xls &#x20;

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

.........\OrderDetails0.xls&#x20;

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

And so on. &#x20;

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. &#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.astera.com/faqs/sources/can-i-split-a-source-file-into-multiple-files-based-on-record-count.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
