Dynamic component leading 0 in formula

Hello everyone,
I would like the leading 0 to appear in the value field. the zer doesn’t appear if placed inside a function.
desired output =>060&length
your help is much appreciated

Try using =CONCATENATE(“0”,length," length")

doesn’t solve the problem
=CONCATENATE(“0”,6)&length
=CONCATENATE(“0”,length," length")

Can you share the component?

Is this the desired output?

test.skp (184.6 KB)
desired outpust is 06&length
length follows the attribute value

Like this?

test modified.skp (181.4 KB)

unfortunetely not,
now is the ouput => 05&length
desired output is => 060&length
length is an attribute with value and not a string

If you put a space before the zero, the zero will show up. There is a space in front of it, though, if that’s an issue.

=" 060"&length

Was following your request. The length you have highlighted in the screen shot is 50 not 60. When I change the length to 60mm in the options panel and change the formula to =CONCATENATE(“0”,length,“&length”), it gives you what you want, I think?

Last try before I have to go do some stuff:

test modified.skp (186.1 KB)

Thanks for following up on this
the leading zero has to appear without a space or other symbol

the formula =CONCATENATE(“060”,length) returns 6060 instead of 06060.

In otherwords, I don’t want the “length” to apprear as a string but returns its attribute value

is there a way that sketchup takes the leading zero when put in a formula? I know the leading zero appears when placed without a formula

image

OK I see what you are seeing now, thanks for clarifying. How is the value used? Why does it need a leading 0? It would help to understand more about your specific use case and how the value is used afterwards.

I don’t think there is a way to force SketchUp to add a leading 0 to a number. The only way to make it appear the way you want it to is with a text string. In the attached file I added a trailing space to get the text string to appear as you want. Below that cell I use the Value() function to convert it back into a number if it needs to be used in a calculation somewhere else.

test modified v3.skp (179.9 KB)

Hello Ryan
the formula attached is not recognized in sketchup.
The leading zero is needed without a space to create a product code which will be exported to CSV and the CSV is uploaded to a MRP. so the exported code has to excatly match the correct code.

For my work flow I run an excel macro to import the generate report csv file. With the macro I’lI adjust formatting to suit my needs, could you do it on the excel side perhaps?

If you place the sizes as a dropdown with space, then there is no conversion of text to number
by pass the value function.skp (22.6 KB)

EDIT: Same as space before. Not a solution

placing the code in the values of a dropdown, with NO equation (=), shows as text. So can pass through to CSV
so A4SU_inventsizeid is the dropdown
length reads the dropdown result in part

test.skp (185.6 KB)

Oh sorry, that was something completely different I was working on. :flushed_face: I changed the file attachment above. Did you try what Philip suggested?