How to append an attribute as a criterion

I’m trying to do something so simple, but can’t find the solution.

I have this rule in a dashboard

$Subtitle=$ChildCount(/Primeira proposta/Grade primeira proposta);

How I can limit the Childcount to the notes that have

$Tipo=Obrigatória

And another dashboard would limit to the notes to the onde inside the Adornment “Básico”

Thanks a lot!

There are lots of ways to do what you want. Here’s one!

Speaking in general terms, you are asking: “How many notes are there inside container X which also satisfy some criterion — here $Tipo==Obrigatória?” That’s the sort of question agents typically answer.

**QUERY: inside(X) & $Tipo==Obrigatória**

You can now set the subtitle of the agent to reflect the agent’s $ChildCount.

Thanks, Mark!

Can I use a dashboard instead of an agent? I have others dashboards at the same level in the hierarchy and the values will change with an agent.

Aha, you have multiple dashboards: this perfectly possible, but probably not the default assumption.

This begs these questions:

  • what is the $Path of the initial dashboard that you asked about in your first post
  • is the relative outline position the same for each pair of dashboard notes and the container of which they need the child count?

Of course! In fact, and agent can inherit from the Dashboard prototype and operate very much like a dashboard.

But, suppose you don’t want to use an agent. Easy enough! The collect_if(group, condition,expression) operator is great for this. It takes three arguments:

  • group: which notes to examine. Here, children(X) — the notes inside the container of interest.
  • condition: the condition that the chosen notes must satisfy. Here, $Tipo==Obrigatória.
  • expression: collect_if builds a list. What do you want a list of? Let’s use $Name, the name of each note.

So, now we have something like $Subtitle=collect_if(children(X),$Tipo==Obrigatória,$Name).count().

(Not tested, so beware off typos and such.)

Great!