Read out $Name(destination) once after a connection has been made


(Sebastian Stuewe) #1

Good day to all.

I am trying to have a user attribute that is automatically filled with the name of the note I make a connection towards.
My workflow goes like this:

  1. Have some notes explaining this or that.
  2. Creating a new note.
  3. Selecting the prototype for that note.
  4. Writing something into it.
  5. Connecting it to the destination note I feel it belongs.

(This is my way of commenting / thinking).

Because I’d like to have all these comments pulled together somewhere else, I want to use an agent. Now, these comments are a lot, and I sometimes don’t remember where a particular comment came from. So I’d like to set a user attribute displaying the name of the note its original connection was made to.

I tried this:

if(!$IsPrototype) { 
$Source |= $Name(destination);
$MyDate |= date("today"); 
}
  1. Where is my thinking error?
  2. I don’t think this can happen as an OnAdd, because upon adding, I may not have a connection. I think this as a rule would be equally resource-wasting, because it only needs to be set once - when all information is available. What better options would I have?

Thanks for reading this far.
Sebastian.


(Mark Anderson) #2

In principle this is fine, but destination and source are link designators and can’t be used in this context. But, if we can assume each comment has only one outbound link then we can use the links() action thus:

if(!$IsPrototype) { 
$Source |= links(original).outbound..$Name;
$MyDate |= date("today"); 
}