Thanks for the test file - I’ll upload an edited version with my solution at the end of this post.
$DueDate(children)
gets us a list of dates which you can’t compare en masse without another operator. You want to test if any child is overdue. Not sure if there’s an op for that. Go to the aTbRef action code listing or the sitemap and get your browser to search a the word ‘any’ and you’ll find the any() operator.
The operator’s task—as with its every() counterpart— is to collect a set of note references, test the condition of an action code expression such as a particular attributes value. For any() the operator is true
if even a single tested note matches the test, while every() is true
only if all items in the tested group match the test.
So, as you correctly guessed in your code above, the grouping we want to test is children. Now what test do we run? You hunch was correct: $DueDate<date("now")
†. Using any() lets us run that test on each item in the list we collected.
I tested this code:
if(any(children,$DueDate<date("today"))){
$Color="red";
}else{
$Color=;
};
which give you the solution I believe you are describing.
In this edited TBX, I’ve put the edict code in a stamp called “Simulate Edict”. The code executes in the same manner but a stamp will only fire once, when the user presses the button. This can be useful for developing edicts (and, more so, rules) as you don’t want to fire of a half-baked code by pressing return too early.
See: OverDueContainerTest1.tbx (78.6 KB). Try the stamp out. Then copy the stamp’s code to the container’s edict and test again.
So, you were close. Your oversight was not to follow through on the ‘any’ aspect which you had correctly stated in your opening question. Although pure query terms like .contains()
can test against a list, tests like yours above generally need a different operator specifically designed to test discretely every list item.
Does that help? Hopefully, you’ve got a solution but as pertinently some idea of where your own initial attempt came unstuck.
†. I see you used the “now” time designator and I “used” today, but it so happens they both resolve at code level to the same test value so there are interchangeable.