OPTIONLABEL() doesn't work

I am trying to set a dynamic component’s name based on the Option Label of another variable. This doesn’t work – I presume it is a bug in SketchUp itself.

The behaviour can be replicated by creating a new DC, creating a custom variable which is set up as a list (choose “Users can select from a list”, then set a couple of List Option and Variable pairs), and then setting the Name field to =OPTIONLABEL(CustomVariable).

The DC editor gives an error “No match found”.

Given that this bug exists, how can I work around this? I need the component’s name to be equal to option label of the custom variable.

Try to use quotes:
Name=OPTIONLABEL(“CustomVariable”)

What do you expect it to show? The List Option or the value?

Thanks Mike. I’ve worked it out with your help.

SketchUp, for some reason, automatically converts my quote symbols into one of three almost identical symbols:
1: " 2: “ 3: ”

I thought I had tried using quotes, but since SketchUp converts my keystroke into one of the three symbols, I hadn’t actually used double quotes.

Presumably SketchUp thinks I’m writing a quotation and tries to guess at the formatting, but this is very unhelpful behaviour in a pseudo-programming situation!

Thanks again.

Ah, yeah you have to turn of ‘Use smart Quotes’ in the system preferences.

Don’t blame SketchUp for Macish behavior. :roll_eyes:

2 Likes

Indeed (I am on a Mac); although this behaviour is a ‘system’ thing, it doesn’t occur with any other programming app – presumably SketchUp could be programmed to override this behaviour.

Dynamic Components is not a programming app. It’s just an interface inside an extension inside an App.
So basically it is a text interpreter.

What happens if you open the Ruby Console (Window->Ruby Console) and enter this:

var='quotes'
puts var

with the smart quotes on/of?

1 Like

Trimble and it’s SketchUp division do not have control over the Ruby core programming language and it’s interpreter which SketchUp uses.

It is a open source project … https://github.com/ruby/ruby

Quotes appear normally within the Ruby console, so this is presumably only a bug for Dynamic Components.

@DanRathbun I understand that Trimble have decided to use an off-the-shelf interpreter for DCs, but I have found the DC implementation in SketchUp generally has a lot of bugs and inconsistencies; it certainly feels like an “interface inside an extension within an App” as Mike put it. It would be nice to see a tighter version developed in the future that blends more seamlessly with SketchUp itself.

1 Like

You and everyone else! I’ve logged bugs that have gone unfixed for at least 5 years!