Rubbish in … rubbish out!
HideDisplayedAttributes
is a boolean attribute, i.e. true
or false
.
sum_if()
sums numbers - so not a boolean result. So your code means
boolean = number
In this case any number that is not zero will result in a true
. So 0
gives false
, 1
gives true
, but -1
also gives true
Thus, if any (1 or more) descendants of the stamp’s note (here “Test Cell”) uses the “Zettelnotes”, the prototype, the HideDisplayedAttributes
value for note “Zettelnotes” will be true
, i.e. the Displayed Attributes table for that note will be hidden.
But alternatively, if no (zero) descendants of the stamp’s note (here “Test Cell”) uses the “Zettelnotes”, the prototype, the HideDisplayedAttributes
value for note “Zettelnotes” will be false
, i.e. the Displayed Attributes table for that note will be shown.
So, that is what is happening. What you haven’t explained is what you wanted to happen.
Also remember that attribute inheritance is not connected to the outline. A child does not inherit its parent’s attribute values (at least, without any code being written). Instead, it uses the document default, or the prototype’s value if there is a prototype and is has a custom value.
So, you say:
I try to set the $HideDisplayedAttributes value for all the children.
So, I read that as you wish to toggle (i.e. show or hide, via $HideDisplayedAttributes
) the Displayed Attributes table of child (or all descendant?) notes. But, based on what criteria?
Possibilities:
- if any child note has the prototype “Zettelnotes”, then all notes show the Displayed Attributes table?
- if any child note has the prototype “Zettelnotes”, then all (but only) notes using the prototype show the Displayed Attributes table?
- either of the above but testing descendants as opposed to just children.
Also, if the prototype is setting the Displayed Attributes table content, you could use a rule like:
if($HideDisplayedAttributes(prototype){
$HideDisplayedAttributes=true;
}else{
$HideDisplayedAttributes=;
};
Using the above, if you hid the Displayed Attributes in the prototype, all notes using the prototype would do the same.
Another way to do the same without the rule is to make two new prototypes:
- “Table-on”. Make $DisplayedAttributes the value currently used by prototype “Zettelnotes”.
- “Table-off”. No customisation at all.
Now, in prototype “Zettelnotes” reset $DisplayedAttributes to the document default of “”, i.e. nothing.
To toggle the “Zettelnotes” Displayed Attributes table on off, you set the prototype’s prototype, i.e. the $Prototype for the “Zettelnotes” to either “Table-on” or “Table-off”.
The “Zettelnotes” prototype will now inherit its Displayed Attributes table from the latter prototype. If “Table-off”, it inherits an empty table so none is drawn (it doesn’t need hiding!) for the prototype and all inheriting notes. If “Table-on” is selected it inherits a table which is now drawn for the prototype and all inheriting notes.
To test the last idea above I suggest a new document (not a copy of an old one). Make sure no local values are set for $DisplayedAttributes or $HideDisplayedAttributes in any of the notes using the “Zettelnotes” prototype. Also make sure the prototype has no rule or edict code (at least not code that affects the Displayed Attributes table).
NOTE: this last method works if you are affecting one feature (here the Displayed Attributes table). It would not work if you wanted to separately control Displayed Attributes and Display Expression; it could but you’d need four new prototypes (both on, Displayed Attributes only, Display Expression only, neither).
However, you can easily have multiple, switchable Displayed Attributes choices via this method. Let us imaging you want a different Displayed Attributes selection for your Zettel notes depending on the task at hand. Now, instead of “Table-on” you would have “Table-on1” and “Table-on2” which each having different Displayed Attributes table items.
My use of prototype names like “Table-off” are only for illustration and they have now special meaning to Tinderbox; they are just the names of prototypes.