An issue with $DisplayExpression

Hi!
Here is my $Edict action code:

if($ToRead=="true")
	{$DisplayExpression=$Name + " ๐Ÿ“•" + " [" + $ChildCount + "]"};
if($Processing=="true";)
	{$DisplayExpression=$Name + " ๐Ÿ“™" + " [" + $ChildCount + "]"};
if($Done=="true";)
	{$DisplayExpression=$Name + " ๐Ÿ“—" + " [" + $ChildCount + "]"};

Action code seems to work because I can see the correct Display Expression in the Text Inspector.

But! I canโ€™t see the result in the outline view:

image

Update: It seems to partially work when the note doesnโ€™t have children, but then it just shows $Name + :closed_book: or :orange_book: or :green_book:.

Any suggestions?
Thanks!

$DisplayExpression is an expression โ€” a formula to be evaluated. For example, a $DisplayExpression might be:

$Name + " ๐Ÿ“•" + " [" + $ChildCount + "]"

Your edict, instead, gets the value of $Name when the edict runs, appends a symbol, and then appends the child count.

Hubert  ๐Ÿ“•  [ 0 ]

This isnโ€™t a value we can evaluate! So, Tinderbox bails out. Sometimes, it might be close enough to a valid expression that Tinderbox will return something, which is what youโ€™re sometimes seeing.

The best way to set different display expressions in an edict is this:

  1. Set up each DisplayExpression in a sample note, perhaps inside the Hints container.

  2. In your edict, set the DisplayExpression of this note to the appropriate sample noteโ€™s DisplayExpression:

if($ToRead=="true")
	{$DisplayExpression=$DisplayExpression(/Hints/examples/ToRead);}
2 Likes

Thank you very much for your kind help!