Concate items, how?

Hello,

I am struggeling with list logic. I want to replace my first item of a name.
“5.880_OG01_RDUK” to f.e. “6.780_OG01_RDUK”
I use split string but the final step to finaly replace the string does not work.
So where is the issue?
I have always to change the front of name
ConcateNewHeights.dyn (36.7 KB)


KR
Andreas

Uff, so managed it almost, but dynamo is setting my strings to NULL

insteat of writing the new name

so i have the issue that they have different lengths


2022-03-14_16h14_38
Have i to change the whole concept?

Are your lists the same length and have the same structure / depth?

Can you post an image with the previews available so we can see what values are goin into the code block?

yes they have the same length.
But the strings the items have different lenghts and they are divided by “_”
i have x_x_x and x_x_x_x items!

i need just to change the front Item from X_x_x_x to Y_x_x

i have the new values i have just to concate them!

2022-03-14_16h52_53
ConcateNewHeights.dyn (72.1 KB)

I think your list structure is just wrong here. Get rid of the List.Chop so your first strings are a single list and use @L1 for the input.

1 Like


it is still setting strings to Cero

if they are splitted into different lengths

That’s a different issue. If you have elements with a different number of values (3 vs 4) then you need to handle that discrepancy. Without knowing which value is “optional” it’s hard to suggest what you should do, but I’d think something with checking the number of items in the sublist of split strings and then using a conditional statement to concat 3 or 4 of the substrings.

you mean prefilter them

@Draxl_Andreas Try something like this with String.Join:


1.dyn (15.3 KB)

2 Likes

I meant something like this:

But @AmolShah’s solution is much better.

2 Likes

the script is realy shorter than! … when i run the script, it is doing not the right stuff.
at least it is renaming something but it is not corresponding :frowning:
ConcateNewHeights_V01.dyn (26.7 KB)


how can i be shure that i do not shuffle my values accidently?

  • i have the hights
  • i make strings
  • i concate the values
  • and set the new name

I think you just need to flatten the final list of strings.

1 Like

Thank you very much finaly it worked! it renames my levels correspondigly.

1 Like