How do I replace the first row of the top DAT with the single row in the second DAT? Is there a DAT which will take these two DATs as input, and spit out what I describe?
I know how to do it with multiple DATs, for example, Select to remove the first row, and Merge to add a new row at the top. I’m wondering if I’m missing a method of doing it with a single DAT.
EDIT: Changed to RFE based on Markus’ reply. Could be added as a functionality to an existing DAT type.
thought I could solve this with the Substitute DAT or the Merge DAT but both were dead ends.
The Substitute DAT currently can’t use references like
me.inputCell in the “Before” or “After” parameter - if that would be possible you could scope the first row and use
me.inputCell.val in the “Before” parameter and
op('table1')[0,me.inputCell.col] in the “After” parameter.
Another possibly useful option would be to have the Merge DAT extended by an option “Replace Cells at Row Index” or “Replace Cells at Column Index” which then would replace the rows / cols starting at the specified index with the data in the other connected DATs.
So, yes - currently and outside of the Script DAT, I see no other option than a 2 DAT approach to this.
Thanks Markus. I’ll change this to an RFE for your teams future consideration.
I think a way to replace using two inputs is analogous to Replace CHOP, and the use case of needing to change the names of rows/columns like in my example may be a common one.
Was just again wishing for this ability. My thought is that it could work in a similar way to the Select DAT where you give a start and end index for either rows or columns, and any rows inside the index are taken from the first DAT, and the other rows are left alone. I mean, in a perfect world, all of the Select options would be available:
From a learning/accessibility standpoint for newcomers to TouchDesigner, it’s perhaps worth considering a whole new DAT, since Merge implies something non-destructive, whereas a new DAT, perhaps called ‘Over DAT’ (analogous to the Over TOP), could imply with its name destructive overwriting. Anyway, just my 2¢
I realize this isn’t ideal, and is kinda the same as the Script DAT solution, but I usually do this with an Eval DAT and it’s “Scope” parameter page:
The biggest downside being that you have to have strings surrounded by quotes or the Eval DAT tries to “evaluate” it.
This isn’t really a problem for me though as I actually use it most often for the use case you show @matijaerceg which is to replace the first row of a DAT with proper column names.
Now what I’d REALLY like to see is a single op way to “Shuffle” the rows and columns of a DAT, kinda like a Shuffle CHOP but specifically: “Sequence cells by row / column” to turn a DAT with multiple rows and columns into a single row or single column - or even just like “Shuffle into x rows / columns”:
personally I would only ever need shuffle to 1 row / column, but who knows, maybe others could come up with some weird uses for this… I would use it for inputs to the Table COMP for example.