# Breakout Output into Multiple Files Conditionally

**URL:** <https://forum.cloverdx.com/t/breakout-output-into-multiple-files-conditionally/1507>\
**Category:** CloverDX Platform\
**Created:** [November 1, 2014, 12:00am UTC](https://forum.cloverdx.com/t/breakout-output-into-multiple-files-conditionally/1507 "2014-11-01T00:00:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yichuansancun](https://avatars.discourse-cdn.com/v4/letter/y/8e7dd6/32.png) [@yichuansancun](https://forum.cloverdx.com/u/yichuansancun)\
**Post date:** [November 1, 2014, 12:00am UTC](https://forum.cloverdx.com/t/breakout-output-into-multiple-files-conditionally/1507/1 "2014-11-01T00:00:00Z")

</div>

Hello -

I am using UniversalDataWriter to write the output using ‘Records per file’ feature. However, the first column of the input data looks looks like the following:

Row number: 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 5, 6, 6, 6, 6, 7, 7, 8, 8… 400,000

Is there a way to tell Clover that, when breaking out the files, don’t break records with same row number into different files. For example, if I choose 5 for the values for ‘records per file’, ‘4, 5, 6, 6, 6’ will be in one file, then ‘6, 7, 7, 8, 8’ will be written to a separate file. But I want all the records with row 6 in one file. In other words, I want Clover to dynamically adjust output records based on a row value here.

Is it possible?

Thanks,

---

<div class="post-metadata">

**Author:** ![slechtaj](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@slechtaj](https://forum.cloverdx.com/u/slechtaj)\
**Post date:** [November 3, 2014, 2:14pm UTC](https://forum.cloverdx.com/t/breakout-output-into-multiple-files-conditionally/1507/2 "2014-11-03T14:14:40Z")

</div>

Hi,

In order to do this, you might take into consideration using “Partition key” attribute. Partitioning simply splits one data flow into multiple different output files based on input field value. There is an article in our documentation that might help you better understand partitioning: [http://doc.cloveretl.com/documentation/ … files.html](http://doc.cloveretl.com/documentation/UserGuide/index.jsp?topic=/com.cloveretl.gui.docs/docs/partitioning-output-into-different-output-files.html)

Hope this helps.
