How to get partial parameter copy to parameter

Hi All,

I’m trying to get a Window Mark to partially copy over to another instance parameter in the same window family. I’ve seen loads of scripts for doing direct like for like transfers but i was wondering if there was a node that would remove the last digit before copying over?

eg. Window Mark = W-S-00-001A
I want the Comment = W-S-00-001

I’m a Dynamo amateur for sure and have only modified other scripts in the past so not sure if possible.

Thanks so much in advance

First get the parameter value.

Then use a String.Length node to find out how many characters are in the string.

Then subtract two from that value with a - node. Note I am suggesting two here instead of one to account for (1) the character you want to remove, and (2) the fact that the characters are stored as indices which start at 0 (like lists).

Then use a String.Substring node to get the characters from 0 to the result of the subtraction node.

Then set the parameter value by name as per usual.

Hi @LMoth
You could do this way using String.Remove node:

1 Like

Ok so Ive set up but the end node seems to have an issue.

Is it because I’m using instance parameters? and the element.type is for type parameters?

Thanks you so much for helping

Ok Fixed it myself.

Thanks you so much :slight_smile:

1 Like

For more complex String Operations, find replace works well.

You can delete string segments with “” in the replace inputs.

1 Like