Welcome, Guest. Please Login
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
Pages: 1
Send Topic Print
Links and actions (Read 777 times)
John-Paul Bogers
Full Member

Posts: 21
Links and actions
Mar 26th, 2016, 4:03pm

I tried to find the solution but I don't understand the info in the tbxref file....
I would like to set the value of an attribute depending on the value of an attribute of a note that links to this note.
I have a note with the title of a book and an attribute called author. I have another note pointing to the first with a link (type "author") with the name of the author in it. How can I copy the value of the name of the author in the author field of the book note?


Back to top
  IP Logged
Mark Anderson
YaBB Administrator

User - not staff!

Posts: 5689
Southsea, UK
Re: Links and actions
Reply #1 - Mar 26th, 2016, 7:05pm
So you have a note for a book (A) and $Author is set to the name of the author of that book. Another note (B), about the same book is, is linked to that book note with the link type 'author'.

Assuming B only links to single note using a link of type 'author' , then to set B's $Author to A's $Author value, use tht following rule in B (code tested in v6.5.0):


Although we're running the code in B, and B links to A, the logic of the linkedTo/linkedFrom operators is that it is the target note (i.e. A) that is tested. Thus we use 'linkedFrom' here, perhaps counter-intuitively - it certainly catches me out every time I use this family of codes.

Note too, this use of the 'that' designator. This is due to the way find() works.  If you were to use 'this' then the code would test is A links with A (instead of B as you desire to test).

If B were to have 'author' typed links to more than one note, B would take the $Author value of the linked-to note with the lowest $OutlineOrder value.
Back to top
« Last Edit: Mar 26th, 2016, 7:07pm by Mark Anderson »  

Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print