Ah, I missed the single quotes in the rule-setting code. Do you have a small test doc that replicates the issue (and includes a note with $Text describing the problem)? It would make it easier to de-bug the issue.
In this line:
$Rule(X)='linkTo(children); $MyList="executedRule"';
are you wanting the $Rule of note X to be set to this code, containing two discrete actionx:
linkTo(children); $MyList="executedRule"
Or, split out for clarity:
linkTo(children);
$MyList="executedRule";
Separately, I’m confused as to the use of a rule here. You only need to to this task once. an edict would be a far less intrusive approach.
I’m also unclear as to the use of the ‘executedRule’ in a list. If you are wanting to make the rule as run then a boolean would make more sense, e.g. $MyBoolean. But, i’d not worry over adding user attributes, they are far less intrusive to the general doc than running unnecessary rules.
Assuming for a moment (pending a test doc) that your code works a better approach would be:
$MyList=collect(descendants,$Path);
$MyList.each(X) {
$MyString(X)=$Rule(X);
$MyBoolean(X)=$RuleDisabled(X);
$MyList(X)=;
$Edict(X)="if($MyBoolean==false){linkTo(children); $MyBoolean==true}"};
$RuleDisabled(X)=false
};
So now each note X gets the $Edict (again split out into linres for clarity):
if($MyBoolean==false){
linkTo(children);
$MyBoolean==true
}
Once set the edict runs the linkTo()
command and sets that note’s MyBoolean
to true
(i.e. ‘ticked’ when seen in Displayed Attributes an other parts of the UI). On second running of the edict, no action occurs as MyBoolean
, having been set, no longer evaluates as false
and so the code inside the if
conditional is not run.