Tinderbox Forum

Inbox rule test not working, what am I doing wrong?

Okay, maybe it is too early in the morning, or maybe I should go back to bed…either way I am stuck. Simple task, not sure what I am doing wrong.

  1. I have a container “/Inbox”
  2. Running a test with the following logic, if inside Inbox and it does not contain “”, Color it red.
  3. Simple, but I obviously am missing something…

InboxRuleTest.tbx (84.4 KB)

Tom

OK, your rule is:

if(inside(/Inbox)&$Topic!=""){$Color="red"};

Asks: "if this note is inside container at path “/Inbox” and $Topic is empty, make this note red. But as ‘this’ note is Inbox, it can’t be inside itself so the first query terms always evaluates false and the colouring code is never run.

What is not clear is if you are trying to colour the Inbox or the container item:

  • If the container, is it if
    • one item (any(children)) has no topic?
    • or of all children (every(children)) has no topic?
  • or, do you wish to colour the child item with no $Topic? If so,
    • only that child,
    • or all children?

If your description of the task is ambiguous it is likely, as here, that the resulting code will not work as expected.

So, what exactly is the task?

Good points Mark. Based on your input…here is where I am

if(inside(/Inbox)&$Topic(any(children)!="")){$Color(any(children))=“red”};

" What is not clear is if you are trying to colour the Inbox or the container item:
Yes. I want to color the container item red in this case.

  • or, do you wish to colour the child item with no $Topic?
    No, not an item with “”, rather any child item that contains a Topic.IOW, I am trying to color any child item with a $Topic

Here is my updated file, will still no luck.

InboxRuleTest.tbx (81.4 KB)

btw…I am using straight quotes in the file, but when I am typing in the forum, it changes it to curly quotes as above.

Tom

I can get this to work with an agent, but not with a rule. Is it because a rule will only act on itself not other notes?

Here is the file with a simple agent.

InboxRuleTest.tbx (96.1 KB)

Tom

Your inbox has a rule

if(inside(/Inbox)&$Topic!=""){$Color="red"};

The rule means, “if this note (the inbox) is inside the inbox and has no topic, then turn the inbox red.

I think you might want a rule for the Inbox:

if(any(child,"$Topic==''")){$Color="red"}  else {$Color=;}

The rule means, “If any child of this note has not topic, turn this not red. Otherwise, the color of this note is whatever color it inherits.

2 Likes