# E10 - Data Directive - multiple iterations

**URL:** <https://www.epiusers.help/t/e10-data-directive-multiple-iterations/55233>\
**Category:** Epicor ERP 10\
**Tags:** data-directive\
**Created:** [May 1, 2019, 6:24pm UTC](https://www.epiusers.help/t/e10-data-directive-multiple-iterations/55233 "2019-05-01T18:24:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![revtb](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@revtb](https://www.epiusers.help/u/revtb)\
**Post date:** [May 1, 2019, 6:24pm UTC](https://www.epiusers.help/t/e10-data-directive-multiple-iterations/55233/1 "2019-05-01T18:24:14Z")

</div>

I have a “Execute Custom” setup under the In-Transaction of OrderHed and anything I place in the “Execute Custom” block runs 6 times.

Currently I have:  
var ttHed = (from row in ttOrderHed select row).Single();  
ttHed.OrderComment = ttHed.OrderComment + " =";

I end up with:  
= = = = = =

If I use a “Set Field” block, then I only get one iteration. Unfortunately I need the Execute Custom as I need to pull data from a ShipTo.Character01 field by customer.

---

<div class="post-metadata">

**Author:** ![timshuwy](https://www.epiusers.help/user_avatar/www.epiusers.help/timshuwy/32/90122_2.png) [@timshuwy](https://www.epiusers.help/u/timshuwy)\
**Post date:** [May 1, 2019, 6:38pm UTC](https://www.epiusers.help/t/e10-data-directive-multiple-iterations/55233/2 "2019-05-01T18:38:56Z")

</div>

one common problem with Data directives is that they DO run every time that the data is modified… what you need to do is add a condition at the beginning that filters out when your C# block is actually run. like “if part number changes from any to any” then run, or something that filters out why you are re-running the C# block.
