# Conditional data reading from Flat file

**URL:** <https://forum.cloverdx.com/t/conditional-data-reading-from-flat-file/554>\
**Category:** CloverDX Platform\
**Created:** [July 14, 2009, 12:00am UTC](https://forum.cloverdx.com/t/conditional-data-reading-from-flat-file/554 "2009-07-14T00:00:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tava.amitava](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@tava.amitava](https://forum.cloverdx.com/u/tava.amitava)\
**Post date:** [July 14, 2009, 12:00am UTC](https://forum.cloverdx.com/t/conditional-data-reading-from-flat-file/554/1 "2009-07-14T00:00:00Z")

</div>

Hi,

I am trying to read some data from a flat file which has header, body and footer. The body content type is described in meta file. While reading the file using skipFirstLine attribute I can escape the first line, but the footer is giving an error message that it is not matching as per meta file. How can I resolve this problem.

Also all the data has a mode section to identify it is header, body or footer like:  
0|HEADER|2009-07-10|FILE NAME|  
1|ABC|A B C|  
1|CDF| C D F|  
2|FOOTER

please note the end of file is in the last line itself.

Tha graph is running well if I give same number of delimiters and a paragraph after last line.  
Ex:  
0|HEADER|2009-07-10|FILE NAME|  
1|ABC|A B C|  
1|CDF| C D F|  
2|FOOTER||

Can any one please help me sorting out this problem.  
Thanks,  
Amit

---

<div class="post-metadata">

**Author:** ![twaller](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@twaller](https://forum.cloverdx.com/u/twaller)\
**Post date:** [July 14, 2009, 11:30am UTC](https://forum.cloverdx.com/t/conditional-data-reading-from-flat-file/554/2 "2009-07-14T11:30:29Z")

</div>

Hello Amit,

As regards your question, I would like to advise you not to forget the possibility of the **Data policy** attribute.  
You can switch its default setting (_Strict_, which causes fails of the graph by each error).  
You can select the other two options: either _Controlled_, which saves errors to console, or _Lenient_, which ignores errors and does not save them.  
In both cases, graph does not fail. If you want to parse the mentioned file, set the **Skip first line** to _true_. And switch **Data policy** to any other value than the default _Strict_.  
It will work, of course, if you do not want to save also the footer.

Best regards

Tomas Waller

---

<div class="post-metadata">

**Author:** ![mzatopek](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mzatopek](https://forum.cloverdx.com/u/mzatopek)\
**Post date:** [July 15, 2009, 9:36am UTC](https://forum.cloverdx.com/t/conditional-data-reading-from-flat-file/554/3 "2009-07-15T09:36:46Z")

</div>

Or you can consider to use the MultiLevelReader component.

---

<div class="post-metadata">

**Author:** ![tava.amitava](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@tava.amitava](https://forum.cloverdx.com/u/tava.amitava)\
**Post date:** [July 15, 2009, 5:14pm UTC](https://forum.cloverdx.com/t/conditional-data-reading-from-flat-file/554/4 "2009-07-15T17:14:45Z")

</div>

Thanks for your help. By setting the datapolicy attribute in reader component to lenient the graph ran successfully.
