# How to \[For Each Loop\] thru Array of Data Table Handles, and repeat \[code\] for each handle?

**URL:** <https://forums.unrealengine.com/t/how-to-for-each-loop-thru-array-of-data-table-handles-and-repeat-code-for-each-handle/747530>\
**Category:** Blueprint\
**Tags:** for-loop, unreal-engine, Array, construction-script, question, Blueprint\
**Created:** [January 12, 2023, 4:54am UTC](https://forums.unrealengine.com/t/how-to-for-each-loop-thru-array-of-data-table-handles-and-repeat-code-for-each-handle/747530 "2023-01-12T04:54:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![XxNotAGamerxX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@XxNotAGamerxX](https://forums.unrealengine.com/u/XxNotAGamerxX)\
**Post date:** [January 12, 2023, 4:54am UTC](https://forums.unrealengine.com/t/how-to-for-each-loop-thru-array-of-data-table-handles-and-repeat-code-for-each-handle/747530/1 "2023-01-12T04:54:29Z")

</div>

UE4.27, Arrays, Loops, and Construction Scripts:

1. 
  - How do I break down a "Data Table **Row" Handle Array-variable** (it’s not a Single row, but an array of 6 DT Row Handles),  
 ![Part 1 split array into single vars](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/c/f/ccfcfe0b31a45a812edbbee27d59a62dd1fe5bb2.png)

2. 
  - So that each Handle (in the Array, there are 6), loops through code, in order from 0 to 5, (thus I am unsure if I need to use a For Each Loop, or with Break, or another cycle node?).

- Here is the DT that shows the Row Handle names:  
 ![DT and Row Handle names](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/1/e/d1e1cc98830f7891b8c361185009e75b1183b4e8.png)

> - (I want to use an Array variable and not a single var, because I want to change sets of items at the same time. E.g. Set = 0 head armor, 1 Top armor, 2 leg armor…  
> So in the variable, I want to predefine which SK pieces to attribute to the head, Top, legs, boots.)  
> ![Using Data Table Row Array so that I can dropbox select var value of 6 singles (elements)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/d/1/2d18343c81512d90bc0fd12ccfa0e1dacc115ff7.png)

> - (If I used a single variable for each armor part, then I have to copy/paste the same code many times, which makes it messy. I want to get it right because I will be using this code in other actors and Event tabs, to set 10 part sets. And I need to save time in how I set the vars.)

 ![Test BPGraphScreenshot_2023Y-01M-11D-18h-12m-36s-538_00 b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/2/d/72d16409b99e1824aaf3338e2dfbea83427ee181.jpeg)

1. 
  - And in the Construction script? (Warning if you test my code: You have to be careful with infinite-loop errors in the Construction tab, or else Engine locks and if the test asset was saved with Construct pin connected, the project is load-locked, unless you do a fix I found.)  
 ![UE4 break Construct pin before compiling or saving untested code 3c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/a/2/6a2f880a79d674edf37365f207c5c860dc970eb0.png)  
.

2. 
  - If I use For Loops, am unsure what to connect as outpins [in the context of my DT Row Handle names] for the Array Element vs Array Index?  
.

3. 
  - I tried using a Map variable. But it is restrictive: I can only make 1 Key (not 6, or I have to make them in reverse), or I cant link the correct DT row handle? (I can only type in the Name (2nd column) of the Data Table row - which I dont want because I want to select the [item name] by using a dropbox, not have to type it in manually.)

Please help (and show pics), this has stalled me for days. Ty.

---

<div class="post-metadata">

**Author:** ![XxNotAGamerxX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@XxNotAGamerxX](https://forums.unrealengine.com/u/XxNotAGamerxX)\
**Post date:** [January 12, 2023, 8:28pm UTC](https://forums.unrealengine.com/t/how-to-for-each-loop-thru-array-of-data-table-handles-and-repeat-code-for-each-handle/747530/2 "2023-01-12T20:28:11Z")

</div>

Anyone know? Ive tried many things. Even tried breaking the Array into 6 single DT Row Handles (like the vars in the yellow comment). And I put the Set Master Pose and SK mesh in a function.  
Then made 6 copies of calls to that function, and 6 copies of single vars to connect to each function pin, in the Construction tab. And it’s crashing the engine.
