Absence of link

I found some post about this but not exactly what I need… I wish to know if there is a very simple way (via agent?) to set the color of a note (say grey) if this note has no links (incoming AND outcoming).

Thanks!

  • Marco.

There isn’t a predefined colour ‘grey’ so I’ve used ‘red’ instead.

As a Stamp:

if($InboundLinkCount==0 & $OutboundLinkCount==0) {$Color="red";}

As an agent:
Query: $InboundLinkCount==0 & $OutboundLinkCount==0
Action: $Color="red";

As just an agent action only:
if($InboundLinkCount(original)==0 & $OutboundLinkCount(original)==0) {$Color="red"}

Note in the last case you need to specify the ‘original’ so it is not the alias’ links being tested.

Testing in v7.3.0. Prototype links are not counted by the above attributes so it doesn’t matter if a note uses a prototype.

Thanks Mark,
but trying these solutions and doing an agent who finds notes without links, so:

Query: $InboundLinkCount==0 & $OutboundLinkCount==0

it seems to me that this is not dynamic, that is, if after adding links to the notes I remove them, these notes are always listed in the agent… there is something wrong? (maybe the LinkCount is not reset after taking a value?)

m.

Check the File menu, is ‘update agents automatically’ ticked? Or, has the agent been turned off? Or, have you code running that creates links - i.e. recreating the links you thought you’d deleted. I’d try recreating the scenario (with minimal data) from scratch in a new file to bowl out the possibility of some abandon test causing issues.

Yes Mark, ‘update agents automatically’, agent isn’t turned off. No other codes are running… I tried to start a new document, with just three notes, then I’ve created an agent with the Query instruction. Immediately the agent is populated with the three notes:

But if I create a link - say from Note 1 to Note 2 I expect that inside the Agent just the Note 3 is displayed, but nothing change:

I’m missing something?

Thanks,

  • m.

Ah, I think you need a query:

$InboundLinkCount(original)==0 & $OutboundLinkCount(original)==0

Notes and aliases share their basic links but they can differ. The above makes sure you’re only looking at links starting and/or ending at an original note. Of course, if you do want to allow aliases in the loop that may prove more difficult.

Thanks Mark, understood!

m.

1 Like