# Dynamic Component Naming based on Attributes

**URL:** <https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747>\
**Category:** Dynamic Components\
**Tags:** components\
**Created:** [February 28, 2020, 10:16pm UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747 "2020-02-28T22:16:03Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![markunderkover](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@markunderkover](https://forums.sketchup.com/u/markunderkover)\
**Post date:** [February 28, 2020, 10:16pm UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/1 "2020-02-28T22:16:03Z")

</div>

Hi all

I’ve created a series of dynamic kitchen cabinets and wanted to generate Naming based on the user input sizes for width and height. Guessing it’s as simple text function but can seem to find it. Basically looking to then be able to have tags in layout that would populate auto text and let me quickly add notes to plan sets

Cheers

Mark

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [February 29, 2020, 12:23am UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/2 "2020-02-29T00:23:22Z")

</div>

Sounds like perhaps the CHOOSE function ?

> _from the [DC User Guide: Supported Functions page](https://help.sketchup.com/en/sketchup/dynamic-component-supported-functions)_ …
> 
> **`CHOOSE(index,value1,value2, ...valueN)`**  
> The `CHOOSE` function returns a value from a list of parameters at the location of the index value. This function allows you to create a single drop-down list that drives multiple attribute changes at once.
> 
> Example:
> 
> `=CHOOSE(2,"Blue","Red","Green")`
> 
> The previous example results in “Red.”
> 
> Use `CHOOSE` and `OPTIONINDEX` together as a mechanism to assign different values depending on a user’s choice in the Component Options dialog box. For example, if the Component Options dialog box allows the user to choose different materials to assign to a component (and the price changes depending on material chosen), the formula for `MSRP` might be:
> 
> `=CHOOSE (OPTIONINDEX("Material"), 100, 150, 200)`
> 
> The previous example returns `100`, `150`, or `200` depending on the material chosen in the Component Options dialog box.

---

<div class="post-metadata">

**Author:** ![ryan.moore](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/ryan.moore/32/106089_2.png) [@ryan.moore](https://forums.sketchup.com/u/ryan.moore)\
**Post date:** [February 29, 2020, 3:26am UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/3 "2020-02-29T03:26:41Z")

</div>

Maybe concatenate?

> [@Can a DC Attribute Text Box (Summary/Description) contain a Formula and html Formatting?](https://forums.sketchup.com/t/can-a-dc-attribute-text-box-summary-description-contain-a-formula-and-html-formatting/42048):
>
> I’ve hit the problem mentioned in the following post, where changing one option across multiple selected components causes each attribute set to “users can see this attribute” to clear to a static number, identical across the board: [Formulas replaced with Values when changing multiple dynamic component options](https://forums.sketchup.com/t/formulas-replaced-with-values-when-changing-multiple-dynamic-component-options/20177/6) I have 3 attributes I’d like displayed for the customer: Price, Bottle count, and Price per bottle. Since I can’t use “users can see this attribute” boxes, is there a way to drive my “S…

---

<div class="post-metadata">

**Author:** ![pcmoor](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/pcmoor/32/3427_2.png) [@pcmoor](https://forums.sketchup.com/u/pcmoor)\
**Post date:** [February 29, 2020, 5:18am UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/4 "2020-02-29T05:18:12Z")

</div>

Before using the “Name” attribute you need to consider if the user will be using the instance name, as changes to the instance can be reflected in both the attribute and option dialog forms. The “Name” attribute over rides this functionality

---

<div class="post-metadata">

**Author:** ![jwoods007](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/jwoods007/32/46399_2.png) [@jwoods007](https://forums.sketchup.com/u/jwoods007)\
**Post date:** [March 23, 2020, 7:46pm UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/5 "2020-03-23T19:46:50Z")

</div>

I’ve been working on the same issue. It’s no problem to generate a “Component Info Name” by any means. But there is no way to replace the “Component Definition” with the “Component Info Name”. So when you go to Layout and use the Label tool, you only get to select an “Entity Name”.

You have to physically replace the “Component Definition” with your desired name for the Label tool in Layout to work.

Generate Report at Level 2 will work for pulling “Component Info Name” .

---

<div class="post-metadata">

**Author:** ![Anssi](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/anssi/32/105_2.png) [@Anssi](https://forums.sketchup.com/u/Anssi)\
**Post date:** [March 23, 2020, 9:29pm UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/6 "2020-03-23T21:29:50Z")

</div>

> [@jwoods007](#):
>
> when you go to Layout and use the Label tool, you only get to select an “Entity Name”

The Label tool in LayOut is perfectly capable of displaying the contents of any custom component attribute you have defined.

---

<div class="post-metadata">

**Author:** ![pcmoor](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/pcmoor/32/3427_2.png) [@pcmoor](https://forums.sketchup.com/u/pcmoor)\
**Post date:** [March 23, 2020, 9:33pm UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/7 "2020-03-23T21:33:21Z")

</div>

I recommend you use the “component instance” name which means you do not use the “name” attribute, however you can reference \_name to get the original definition if required in attribute formulas.  
It must be noted that the automatic changes and updates happen only after the DC is saved and inserted into a file.  
Use component definition as a general term like beam, panel…

---

<div class="post-metadata">

**Author:** ![jwoods007](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/jwoods007/32/46399_2.png) [@jwoods007](https://forums.sketchup.com/u/jwoods007)\
**Post date:** [March 23, 2020, 11:05pm UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/8 "2020-03-23T23:05:40Z")

</div>

![SketchUp](https://global.discourse-cdn.com/sketchup/original/3X/d/b/db768d61c39f69abd08215d69fe355da1282e22f.png) ![Layout](https://global.discourse-cdn.com/sketchup/original/3X/2/1/21eca9806776ab3497bbf55a0041e37cc53e6b09.png)  
I’d be very excited to discover the gap in my thinking.

---

<div class="post-metadata">

**Author:** ![pcmoor](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/pcmoor/32/3427_2.png) [@pcmoor](https://forums.sketchup.com/u/pcmoor)\
**Post date:** [March 24, 2020, 7:01am UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/9 "2020-03-24T07:01:45Z")

</div>

![Capture 2](https://global.discourse-cdn.com/sketchup/original/3X/c/4/c41acbf667c432f95575c3504ac734397cd13e37.jpeg) ![Capture](https://global.discourse-cdn.com/sketchup/original/3X/4/c/4c132a0cdb9b989c117abf1504eaf7a7ca522b33.jpeg)  
Delete the name Attribute in the DC then put a value in the instance, you will find the option name and attribute dialog will follow suit, then in layout it will be available too.  
Any attribute should be available in layout provided you expose it in the option dialog  
[boards grain on X test.skp](https://forums.sketchup.com/uploads/short-url/8QnwTmr2s8bAGGGZTvC82NwthPu.skp) (572.9 KB)

As per the attached file change any instance and see how it updates, see report attached to file as well

---

<div class="post-metadata">

**Author:** ![jwoods007](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/jwoods007/32/46399_2.png) [@jwoods007](https://forums.sketchup.com/u/jwoods007)\
**Post date:** [March 24, 2020, 1:01pm UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/10 "2020-03-24T13:01:28Z")

</div>

![Layout2](https://global.discourse-cdn.com/sketchup/original/3X/7/2/72b506fd045cf7d8b46f9f5f8899b653855243e2.png)  
Now I’m excited. Never once, did I ever, click on CAB BLANK#1 to reveal the “Choose Label Text” list on the right. btw I didn’t have to delete the DC name attribute or put a value in the instance. It worked as is.

I humbly submit myself for a page in the next “Doh” handbook. Thank You

---

<div class="post-metadata">

**Author:** ![pcmoor](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/pcmoor/32/3427_2.png) [@pcmoor](https://forums.sketchup.com/u/pcmoor)\
**Post date:** [March 24, 2020, 10:26pm UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/11 "2020-03-24T22:26:32Z")

</div>

I think we all deserve a mention in the “doh!” book, there is always some treasure to be discovered in Sketchup, it is its simplistic face with complexity under the surface.

> [@jwoods007](#):
>
> DC name attribute or put a value in the instance

You can use the Name attribute, but it disables the connection of the instance naming to all parts of a project, I believe an under used gem. However there is no set way to model, neither should there be, another good aspect of Sketchup

---

<div class="post-metadata">

**Author:** ![markunderkover](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@markunderkover](https://forums.sketchup.com/u/markunderkover)\
**Post date:** [April 1, 2020, 12:40am UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/12 "2020-04-01T00:40:58Z")

</div>

Thanks all for your help, wonder how I can now get it to generate a name based on the custom attributes selected.

For example; if I select 36" for cabinet width and 30" for height, is there a way to generate a component name of BCab\_36\_30 in the dynamic component name attribute that would then be selected form Label text in Layout

 ![Screen Shot 2020-03-31 at 6.31.12 PM](https://global.discourse-cdn.com/sketchup/original/3X/d/0/d0a4c1eda3090b5d08c57e851a5cfc0d51a9976c.png)

---

<div class="post-metadata">

**Author:** ![susketch17](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@susketch17](https://forums.sketchup.com/u/susketch17)\
**Post date:** [April 1, 2020, 1:31am UTC](https://forums.sketchup.com/t/dynamic-component-naming-based-on-attributes/117747/13 "2020-04-01T01:31:56Z")

</div>

@markunderkover

use concatenate function in the Name field.  
=concatenate(“BCab\_”,CabWidth,“\_”,CabHeight)
