Control code (string)

Control code

Hello everyone,

A few days ago I needed to create a unique code for each element. Which was the union of three parameters (“Element”, “Floor / Level” and “sector”). I get the result I want but the scrip is too large. Someone can help me to optimize.1. Crear Codificacion.dyn (370.5 KB)

Code blocks are your friend.

Try this in a code block:

String.Split(Element.GetParameterValueByName(elements, “Parameter 1 Name”), “Splitting String 1”)+
Divider 1”+
String.Split(Element.GetParameterValueByName(elements, “Parameter 2 Name”), “Splitting String 2”)+
Divider 2”+
1…List.Count(elements);

Other methods when you’re at the point of trying to make things fit better for organization/flow is to turn what you made into a custom node, or using the node to code function to automate code block creation, or reworking the effort using python instead.

Thanks,

You rigth. I sometimes forget to use thecode block. I’ll try to apply your advice and I will raise the solution.