Go from List to Element


#1

This is probably a very simple question, but how do I interact with an element in a list? In my example, I used the RemoveListFromList node to find the unique element ID from two lists of element IDs. I want to write to a parameter for that element.


#2

Very similar I post I think Filter out rooms by parameter “Name” by multiple values. Or isn’t this what you want to achieve? Filter a list based upon another lists values


#3

By default, most nodes will accept a list. Some may require additional management in the way of lacing or list levels, but there’s no issue with using a list as an input. In fact, it’s more common than a single item input.

If you need to get a single item from a list, it’s best to use GetItemByIndex or the DS shorthand. Keep in mind a list with one item will still be processed as a list, not a singleton, so it may be necessary to pull your element from a single length list.


#4

There will most likely be multiple items in the list I want to write to. What I posted was just an example, which shows only a single element.

I made some progress but am am confused by the result I am getting. The result of the RemoveListFromList is correct. However, when I use that result in the List.FilterByBoolMask node, I get a different result.


#5

I think I just figured it out. I changed the Lacing on the String.Contains node to Longest.


#6

You kind of hit on my point of a singleton vs a list with a single item. You’re feeding StringContains a list of a single item so it’s trying to match up with the str input. Changing the lacing to longest has it search for each item in the searchFor list (which is only a single item in this case) so it returns a list (of a single item).

Reducing your searchFor list to a singleton would also give you the correct output, and would actually be the “more correct” solution because it doesn’t change your list structure. That likely doesn’t matter in this case though.