How to correct Error message about Display Expression

I am getting the following error message that I don’t know how to correct:

This note’s $DisplayExpression cannot be parsed: No attribute
named $DisplayExpressionCache

I don’t know where to look for the DisplayExpression let alone how to fix it. The message seems to be on all of my notes so I don’t know how to narrow it down to where the problem is.

Any suggestions?

Diane

OK, is looks like you’ve copied a note, or opened a TBX from someone else that assumes the document has a user attribute (likely String-type) called DisplayExpressionCache.

So this is user [sic] error, albeit unintentional. You have unwittingly (re-)used notes with that depend on code/attributes you din’t copy.

The easiest fix is to select all the affected notes, and use the Quickstamp Inspector to reset to the Display Expression attribute ($DisplayExpression) default, i.e. no code.

When I go to quickstamp I don’t know what to put where. I tried creating a stamp to set $DisplayExpression to 0 and it backfired. I tried setting it to default and that doesn’t work. What then, is no code?

Here’s the Inspector Pane for Display Expression:

My apologies, I was in a hurry yesterday and should have given more detail.

The problem is that you have notes that have action code set in their Display Expression. This code is stored in the system attribute DisplayExpression, which by local convention we refer to as $DisplayExpression—i.e. contextually the attribute or its current value.

The DisplayExpression attribute is an ‘action’ type, which is itself a special form of String type, so the default is ‘no value’ which for this type is an empty string.

Before looking at where/how we rest the attribute, check how many notes if have the issue:

  • #1 if only one note , we can just edit that note.
  • If more than one, check if the notes are:
    • #2 using a prototype that sets the Display Expression, or were. In the case of a prototype, we’ll want
      *#3 created by an OnAdd or agent’s action that set the Display Expression code.

In the case of #2 we first check/reset the prototype’s Display Expression. Then/otherwise we select all notes with the ‘bad’ Display Expression and reset it by any of the methods below (in no particular order)

Method 1: Text Inspector

Open the Text Inspector, selecting the ‘Title’ sub-tab:

Now select and delete all content in the large box labelled `Display Expression’. This should fix the problem—at least for the notes you’ve edited.

Method 1: Quickstamp Inspector

Use shortcut ⌘+2 or Open the Properties Inspector, selecting the 'Quickstamp ’ sub-tab:

Select all the affected notes. In the top search box of the Inspector type DisplayExpression and press they Return key. This will auto-select $DisplayExpression as the target of the Inspector’s changes.

Now click the key shown:

Properties Inspector: untitled 2023-11-18 09-53-08

And see the result:

Properties Inspector: untitled 2023-11-18 09-53-59

Then, click the Apply button. You can close the Inspector, the task is done.

Method 3 Use a stamp (action code)

Make a stamp. Open the Stamps Inspector, and add a new stamp. Call the stamp “Reset Display Expression”. In the stamps’ code box, enter this code:

$DisplayExpression=;

Click out of the code box. The stamp is ready to use.

Leave the Stamps Inspector open and select all the affected notes. Now, on the Stamps Inspector, the ‘Reset Display Expression’ stamp is selected and click the Apply button.

Summary

Note, you could use an agent to find affected notes and the agent action to reset their Display Expression. But, until you’re more comfortable with how the Display Expression system works, one of the above are the best approach.

I hope that helps. :slight_smile:


†. What does a Display Expression do? See my article on Display Expressions.
‡. Using code =; to reset an attribute - see more on setting the default and re-setting inheritance.

Hi Diane, you got this from me. I used $DisplayExpressionCache as an optimization affordance. If you’ve not fixed this yet, you san simply create the $DisplayExpressCache attribute as a String.

1 Like