I’m attempting to use $DisplayExpression to show me more information in the name of a note. Currently a note is evaluated by an agent to see if it has a $DueDate and/or $ContextTag. Depending on which it has depends on what is displayed with the $DisplayExpression. My current agent code is:
if($DueDate&$ContextTag){$DisplayExpression=‘“[”+$ContextTag+"] “+date($DueDate).format(“W, d MM y”)+” | "+$Name’}else{if($DueDate&!$ContextTag){$DisplayExpression=‘date($DueDate).format(“W, d MM y”)+" | "+$Name’}else{if($DueDate==“never”&$ContextTag){$DisplayExpression=‘“[”+$ContextTag+"] "+$Name’}else{$DisplayExpression=;}}}
This works as follows:
If the note $Name is “Speak to Harold about widget X” and has no $DueDate or $ContextTag the $DisplayExpression shows:
Speak to Harold about widget X
If the note has only a $DueDate the note $DisplayExpression:
Friday, 24 February 2017 | Speak to Harold about widget X
If the note has only a $ContextTag the note $DisplayExpression:
[call] Speak to Harold about widget X
If the note has both a $DueDate and $ContextTag the note $DisplayExpression:
[call] Friday, 24 February 2017 | Speak to Harold about widget X
I’m realizing that this can be extremely useful and want to employ it for more attributes. However, the more attributes, the more permutations of combinations of attributes, making the action almost impossible to code.
Is there a simple way to do this? Can I set a agent to work out which attributes are not empty and automatically add them to the $DisplayExpression?
You may ask, “what’s the point?”, can’t you just look at the attributes? My reasoning is that I have a long list of projects, tasks, meetings and events. For projects I want to see the task count, for tasks I want to see the due date and context, for meetings I want to see the due date and who’s responsible for the meeting. If I could manipulate the display expression to be smart, these various pieces of information would be displayed in the list reducing the need to click on each note.