Cant make my code run

I am trying to copy a parameter value to another parameter. But I want to filter to specific instances.
In this case I’m trying to copy View Name to Title on Sheet. but only for the views with DSN_W in the name.

Heya, welcome to the community :slight_smile:

If you ‘Watch’ all your nodes, you’ll see how the data is flowing, and if there is anything unusual.

If you hover over the Yellow (warning) nodes, at the top, you’ll get a description of the problem… Then you can tell us what it says :slight_smile:

Right now, the fact that you’re feeding the ‘Title on Sheet’ parameter value (so it is a String ie.Text), as a list, into a port which wants an ‘Index’ (ie. Number) is a good place to look for solving things…

Hope that helps,

Mark

I am now getting this error at List.ReplaceItemAtIndex: Warning: List.ReplaceItemAtIndex operation failed.
Index was outside the bounds of the array.

For me, this was the reason… :slight_smile:

There are only 3 indexes but I asking for 4… However, there are still other issues…!

dont need the replace at index.
create a new filterbybool. put it before element.getParameter by name that is looking at Title on Sheet.
use your string contains bool as mask.
plug it directily in to your Element.SetParameter

I think that I get what you’re thinking. I have to say I am very new to Dynamo and I just dont know how to finish it from here.

You need to show node preview bubbles or watch nodes for all your data. Otherwise we have no idea what’s actually going on in your graph. What do the inputs you’re providing ReplaceItemAtIndex actually look like?

Also, as @stefan.gokstorp mentioned, there’s no need for ReplaceItemAtIndex at all. In fact, the whole upper branch isn’t nececarry. You just filter the views that match your condition and then set their Title on Sheet to their View Name.

1 Like

I think I’m able to follow you. just how would I replace their conditions.

I guess you mean this:.


This works but it is at the wrong instances.
I have sections with different names. with the second script it copies DSN_W10 to section 5 instead of DSN_W10.

Warning: Element.SetParameterByName operation failed.
No parameter found by that name.

Right now you filter the values but not the views. You just need to filter the original list of views before you assign values. If they match the condition (contain DSN_W) then filter and update with the same list of filtered values.

Can you help me out because I’m unable to follow you.

I found out how I could make it work. THanks for the help everyone.

1 Like