PCG Loop Number of Iterrations

Hi I’m wondering if there’s any way to get the number of loop iterations of a PCG loop and/or sum the value of attributes in an array. For example I’m trying to do something like this pseudocode:

weights = Array of float values
sum = sum of the values in weights
normalizedWeights = new array
for each weight in weights {
normalizedWeights[i] = wights[i] / sum
}
return normalizedWeights

or even just

meshes = array of arrays of meshes
for each array in meshes {
max = (index + 1) * (1 / numberOfItterations)
min = (index) * (1 / numberOfItterations)
– spawn all meshes in array when density is between min and max
}

Is anything like these possible in unreal pcg? It seems like there should be but I can’t seem to make it work. I’m pretty sure I’m missing something here so i would love some help!

Just solved this with a little experimentation, turns out learning a little bit about the inspect panel in the editor is useful. But two “Get Entries Count” nodes can get the number of entries which can get then be passed to the loop, and there’s a sum node if you need a sum!

See the pic below for my implementation, where the “num” input to the loop is the number of times the loop will run. This could then be packaged into another subgraph to clean things up because the inputs to the double entries chain, and the “Meshes” input are the same. Hope this helps someone!