List.AllIndicesOf skips some entries!


#1

I have a correct list of 252 rooms and check if there are some Revit elements inside. This gives me a list with true or false (as child of the rooms) for each element.

Now I need to know the index of every “true” in the sublists. So I use List.Map along with List.AllIndicesOf. This gives a list with only 246 items instead of the 252 rooms I really have in the list!
I marked it in my screenshot.

List.AllIndicesOf skipped the first 6 items from my original list. List.IndexOf gives me the full 252 items but this node is limited to 1 item per list.


#2

I think I found out what happens - can anybody provide me with a workaround?

The first six list items have no “true” - this are the ones which are skipped. I think List.AllIndicesOf will remove the first items if there are no indices found :disappointed_relieved:


#3

I’m a bit lost. Sounds like we need a larger glimpse into what you’re after here. Can you explain your overall workflow, and post a camera export of your graph?


#4

I havent seen list.map in ages… thank god :slight_smile:
Click the little arrow to the right of the list input and change the List Level


#5

Thanks for your answers!

@Daniel_Hurtubise you nailed it! When I change to list level 2 the missing items in front are there :slightly_smiling_face:

I use list.map quite often…seems like there are easier ways?


#6

List@Level is the way to go, no need for List.map anymore.

Check this article http://dynamobim.org/introducing-listlevel-working-with-lists-made-easier/


#7

Thanks for the URL, I will check it later. I was never a great fan of List.Map.

Found another curiosity in my script. Look at my screenshot. List before and after “List.LaceLongest” is correct, but LaceLongest itself misses again my first 6 empty lists. What’s the reason here? I can live with it because after it I have the correct data but it scares me a bit to see elements missing :wink:
Btw: Same result if I use only List.Combine instead.


#8

I love List.Map.