"Contains" for Spread Collection with Objects

hi all,

how do I patch something similar to this for my Spread collection? I cannot use dict because I need indices. Cannot use “contains” because I need objects.

Wasn’t there a contains (predicate) region? I think that one could fit your usecase.

Something like this?
SpreadContainsvl.vl (13.7 KB)

You should look towards LINQ pseudo code would be something like this:
var result = inputCollection.Where(i => i.desiredProperty == inputProperty);

if you need one slice you have to add .FirstOrDefault() in the end

ok, it looks like the Contains (Selector) in the corelib is wrong…

but you can easily make yourself a region for such a purpose or use some linq nodes like firstordefault in this case:

SpreadContains.vl (31.9 KB) :

1 Like

thx sebl, but I am still stuck. I want to check my collection of objects with path against another collection of path. (btw where is the “contains” region with just one input?) I have to check if the file is contained within my collection, and if not, I need its index, or path to add it. I don’t know how to do that with the regions in your example.


AutoReloadSpread.vl (37.7 KB)

I mean there has to be a nicer solution to this than mine.

There’re nodes called Synchronizer in our VL.CoreLib which might do exactly what you’re looking for. You’d use it like this:

@gregsn Can you say more about them? Maybe we should get them out of the experimental state?

this looks neat, but it outputs an sorted collection. is there a way to do this like a list?

Not quite sure what you mean. It outputs a spread and the order of its slices is given by the input spread.

I was looking for a nifty way to watch a directory and add new files to an indexable collection. in order of their creation.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.