Hi all,
I am trying to see if there is a workaround to append elements to a list and keep them forever despite any change of input…
Say I have items ‘A’, ‘B’, ‘C’ coming to my list.
Then my input change (I am using Human UI where the user can pick elements from a checklist).
‘A’ and ‘C’ remain selected but ‘B’ disappear and a new input ‘D’ is being selected.
I now want the list to be ‘A’,‘B’,‘C’,‘D’ not just ‘A’,‘C’,‘D’
What would be the easiest? Some Python/C# or is there already some built-in elements to do it?
Hope that’s not too confusing.
Hey,
I’m not sure if I understand it well, but if so: maybe Merge component is what you’re looking for:

Or deal with trees and Entwine component, this way if B will disappear, then you will still have a “place” for it:

1 Like
Hi, well no I wanted to simulate the “append” method of Python where values are stored in the dictionary despite change of input.The idea is to keep adding new values to a list while keeping any previous ones. I’ll do it with a Python component I guess.
Thanks anyway
Thanks Joseph, yes completely forgot about the recorder. Does what I need. Just wish there would be an extra boolean input to reset the data with a trigger rather than doing it on the component itself.
Try this one. (input: reset = boolean, x = list of data)
if reset:
data=set()
if not 'data' in globals():
data=set()
data=data.union(x)
a=data