List.each()
looping to the rescue! You scene note (or prototype for scene notes) want this as, or added to, its $Rule:
Code:$CompleteState=0;
$KeyAttributes.each(X) {
if(eval("$"+X)) {
$CompleteState = $CompleteState + 1;
}
};
$Pattern="bar($CompleteState,0,$KeyAttributes.size)";
To use the above, you also need to add a Number-type user attribute called "CompleteState".
The loop takes each item in $KeyAttributes, which is an attribute without a $-prefix, turns it into an attribute $-reference and then does a
short-form attribute evaluation to get a true/false result as to that attribute's completion. On completion of the loop, each attribute's completion state is test.
The latter is perhaps an over simplification as the test is whether the attribute is in non-default state. If you need a different test for 'completion' of the attribute then you will need to code a test for each attribute.
The $Pattern bit is a for Map view use. It will show a
progress bar on the notes map icon giving a visual indication of completeness. As the latter is always stored in $CompleteState, you can leave the $Pattern code out from the Scene note and use it on a dashboard elsewhere in the TBX.
Unwittingly, your scenario needs one of the more complex things action code can do. So do ask if stuck or it simply doesn't make sense.
If you don't want to check
all key attributes, make a new Set attribute called $MandatoryAttributes and copy to it from $KeyAttributes only those attributes whose completion you wish to check. Amend the code example above to use $MandatoryAttributes.