I’d like to change a note’s Badge and Color when it is $Checked, but inherit the prototype’s values otherwise.
The first part is straightforward, but I’m stuck on the second. The Displayed Attributes interface has a ‘normal’ value that I can use. Is there something analogous to use in action code?
Right now, I have this clumsy business, which doesn’t quite do what I want.
if ($IsPrototype==false) {
if ($Checked==true) {
$Badge="check";
$Color="dark blue";
} else {
$Badge=$Badge("/Prototypes/Task");
$Color=$Color("/Prototypes/Task");
}
}
Why are you checking $IsPrototype==false? It implies you haven’t fully described the test case.
Remember, it’s easy to state the result is ‘wrong’. The resolution is to check the logic of your tests. Normally the error is incorrect action code syntax or testing the wrong condition.
I think you missed my question. Here’s what I asked:
The Displayed Attributes interface has a ‘normal’ value that I can use. Is there something analogous to use in action code?
Using the Displayed Attributes interface to select a value for an attribute, you have the option of selecting the ‘normal’ value. As I understand it, selecting ‘normal’ removes any note-specific values so that a note will use the inherited value of its prototype or otherwise fall back on the default.
My question was, how do you accomplish the same thing in action code?
The method in my (and your) code examples isn’t ideal.
First, it hard-codes the prototype name, so if you change the name of the prototype you also need to change the code. And second, I believe that it copies the value from prototype instead of inheriting it, so that if you change the prototype’s Badge or Color, the note won’t inherit the new value.
So I thinking there must be a way to do this that I haven’t learned.