Relative item

Hi all,

I was wondering. Is there a way to offset your dataTree using a syntax like {*;1}?
I am making a component in which I use the relative item component. The thing is, depending on the amount of items in my input, the number of dimensions in my path changes.
So what I would like to achieve is that no matter what, the relative item component will offset only the last dimension by 1.
i.e.:
{4;6} => {4;7}
{3} => {4}
{0;4;2} => {0;4;3}

Would this be possible somehow?

Regards,

Merijn

I have never used it myself, but perhaps the “path mapper” tool is what you are looking for.

Thanks for your reply.
I believe the pathmapper only works with the exact amount of path elements to be mapped

Correct, you can specify multiple mappings in case you have a tree with different length branches (almost always a huge red flag that), but you cannot make it truly adaptive.

You could for example specify the following mappings:

{Z} -> {Z+1}
{A;Z} -> {A;Z+1}
{A;B;Z} -> {A;B;Z+1}
{A;B;C;Z} -> {A;B;C;Z+1}
{A;B;C;D;Z} -> {A;B;C;D;Z+1}

If you want to do it properly, you’ll have to operate directly on the paths in the tree. You can get all the paths out of a tree using the Tree Statistics component, turn your paths into integer lists using the Deconstruct Path component, modify the integers, put it back together using Construct Path and then Replace Paths to swap out the old ones for the new ones.

A alright, thought this might be the only way. Was looking for a simpler/cleaner way.
Maybe I’ll just code it then, or just go with the extra spaghetti of course :wink:
Thanks anyway!