Bases formulas do not see properties with a hyphen in the property key

Creating a property using a function does not work if the function references an existing property that has a hyphen (“-”) in the property key, for example first-name. The same function does work when you reference a key that do not have hyphens in the name.

Steps to reproduce

  1. Create a note and add a property with a hyphen in the key, e.g. first-name. Also add a property with no hyphen in the key, e.g. firstname. Put a value for each property.
  2. Create a Bases and filter so you see the note you created.
  3. Add the firstname and first-name properties so you can see the values
  4. In the Base, create a new property with the formula firstname, this will work as expected
  5. In the Base, create a new property with the formula first-name, this field will be empty

Did you follow the troubleshooting guide? [Y/N]

Yes, and I recreated the bug in the sandbox vault. See the screenshot below.

Expected result

The new property that references a property with a hyphen in the key should show the value for that property.

Actual result

The new property is blank.

Environment

SYSTEM INFO:
Obsidian version: v1.9.4
Installer version: v1.7.7
Operating system: Windows 11 Pro 10.0.26100
Login status: logged in
Language: en
Catalyst license: insider
Insider build toggle: on
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none


Additional information

Try note["first-name"].

From Discord:

Hyphens in property names appear to work in many cases but not in Bases formulas.

E.g., if(sent.isEmpty(), dates-recorded, sent) doesn’t return dates-recorded

In formulas it conflicts with subtraction so you’ll need to write it as note[“dates-recorded”]

Yes, this solved my issue. Thank you!

For others, the documentation on referring to properties in formulas is here:

  • Properties in the frontmatter are called note properties. For example note.price or note["price"]. If a property does not have a prefix it is assumed to be a note property.