How to swap text content (swap 2 variables) in Dynamo?

Hi, I am new to Dynamo. I am trying to create a script to swap text content. My script below sometimes works and sometimes not works. I tried temporary variable but it does not work too

@duongpe Welcome to the Dynamo community.
Try this


I’m guessing part of the problem is that you’re converting both notes at the same time. If you force a linear order and use a temporary variable it should work.

1 Like

If you’re just switching entire note blocks then @AmolShah’s solution is perfect. If you need to switch substrings you’ll want to use a temporary replacement and force order.

@AmolShah Thank you, your solution works well

@Nick_Boyts How can I force linear order in Dynamo?

If your script doesn’t naturally allow you to string nodes together in a progressive order you can use a Wait node to do it for you. There are a few custom wait nodes in some of the common packages or you can create your own with a simple code block. There are more posts in the forum that cover the specifics if you’re interested.

Thank you for your suggestion. I will search the forum to learn more