# Control code (string)

**URL:** https://forum.dynamobim.com/t/control-code-string/11712
**Category:** Uncategorized
**Created:** [May 11, 2017, 7:46pm UTC](https://forum.dynamobim.com/t/control-code-string/11712 "2017-05-11T19:46:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Tripler123](https://avatars.discourse-cdn.com/v4/letter/t/49beb7/32.png) [@Tripler123](https://forum.dynamobim.com/u/Tripler123)
#### Post date: [May 11, 2017, 7:46pm UTC](https://forum.dynamobim.com/t/control-code-string/11712/1 "2017-05-11T19:46:18Z")

</div>

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](https://forum.dynamobim.com/uploads/short-url/hmKJSZH3AH0fb2k62lU6JiMRjLl.dyn) (370.5 KB)

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/4/3458c3f5b728a0d822603d17c07bad662ad40566.png)

---

<div class="post-metadata">

### Author: ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)
#### Post date: [May 11, 2017, 9:27pm UTC](https://forum.dynamobim.com/t/control-code-string/11712/2 "2017-05-11T21:27:37Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Tripler123](https://avatars.discourse-cdn.com/v4/letter/t/49beb7/32.png) [@Tripler123](https://forum.dynamobim.com/u/Tripler123)
#### Post date: [May 11, 2017, 10:37pm UTC](https://forum.dynamobim.com/t/control-code-string/11712/3 "2017-05-11T22:37:36Z")

</div>

Thanks,

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