I was just looking at the distinct (string) and for a particular usage, I would need a slice index output, so I could sync a couple of lists via their distinct addresses. However in VL the distinct is a node that is not editable, or is it and I don’t know how to do that?
indeed Distinct is not editable since it is a core .net operation we just imported. can you outline your usecase a bit more in detail so we can suggest you ways to handle it?
This particular case, I have some kontrolleur addresses, values, fade times, I have multiple presets that I can trigger simultaneously and therefore I only want one set of values + fades per unique address, I already have them sorted so the 1st occurrence, is the one I want to use, I’m currently using sifts and selects to do this, but was looking at reproducing the behavior in vl.
the most easy way is to create a data type that not only stores your data but also the index, or some sort of ID. then after the distinct you can ask the slices of your type for its index/ID…
just noticed that the Distinct (Selector) has moved into the DevLib. so you need to reference this in order to make a custom distinct:
Distinct Index.zip (6.8 KB)
So this seems to use more clicks than using occurrence (string), so I guess I need to get it to only evaluate on the input changing? Can’t seem to find ‘show apply’ in a right click menu?
Also I’ve an intersect routine patched too, that needs a slice index, is there a version of that available?
you mean more clicks performance-wise? this might be the from/to vvvv overhead. i would try to implement as much logic as possible in one vl node so vvvv only gets neatly prepared data to display.
a ‘calculate only on change’ can be implemented in many ways. one would be to take this vl patch, put it in a util operation and use a changed node on the input data to set the apply pin to true.
all vl operation nodes should have that pin… not on the vvvv side though. right click on node -> configure -> show apply or simply a middle click on the node.
this could be patched in the same way, but we have not imported the intersect functionality with a key selector delegate. i’ll add it to the feature requests…
so in general, i would try to extract as big as possible parts of the logic and model it with data types and think about how they could interact with each other. if you solved your problem with types, indices usually don’t play much of a role anymore because the relation between the data entities are kept by instances of your types…
DataStructure.zip (7.8 KB)
How do i add more elements into the datatype, I have a blue output pin, the others are green.
the type in your example has 3 properties (aka fields) that it stores (Name, Age, Color) you can add a new one by creating a ‘Pad’ via the nodebrowser, or clicking on the quad with the ‘R’ besides the type name to open the patch explorer where you have a ‘+’ button.
and as you can see in the explorer the type has 3 operations, Create (white), Join (blue) and Split (green). create is not in use, but join and split.
when join is called it takes new data on the inputs and stores it into the fields and returns a new instance with the new data. split just reads the data of an instance and outputs it.
to create pins for a specific operation you have two ways. either start a link and double click or create them via the node browser (“Input” / “Output”).
if a pin is not assigned to the operation you intended, right click the pin → Assign → choose existing operation or make a new one.
new operations can also be added via the explorer…
Thanks Tebjan, that was very helpful (gif recorder yay!)
So next up, I have a spread of hundreds of slices, all strings,
1 node label
2 node tag
7 Patch name
I’d like to create an spread of Data objects, packing every 8 slices into 1 slice of an object. I thought I could use a loop region set to 8 interactions, and somehow get slice, or use an unzip, or something, but I think maybe I should looking for a different concept?
Of course I could unzip them in v4 and use the above VL patch with 8 inputs, but seems a bit stupid to do that!
hmyes, there are several ways to do that in vl.
the conversion from single values in a list to a higher level objects always requires a bit of boiler plate code to tell the machine how the values should be stored in the object. a loop based population of the data fields is not really possible. but the good thing is you can parse the strings into actual numbers or even spreads…
then you can call this “factory method” in a loop to convert the spread into objects of your desired type:
DataJoin.zip (7.7 KB)
but the solution with the least nodes might actually be the unzip in vvvv and 8 input solution. it could be done with a slightly modified version of the factory method above. but it might perform a bit worse because of the overhead of the many pins.
latest alpha now has Intersect, Union and Except node in the DevLib with a selector delegate input to specify the key value on which to operate.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.