Something made me think you have 2 libraries. If they are all in the same library, then in that library, define B-D as JS fields with this script...
field("A");
Because you have only 1 library & everything's together, it simplifies things, and you don't need that link field (source) and the code -- field("source") -- that goes with it.
Does that make sense?
If you'd like to learn JS, I recommend you install the Grasshopper app from the Google Play store (Google bought Grasshopper. It's safe.) on your Android device & take only the 1st 2 courses (Fundamentals 1 & 2). That minor subset of JS is all you need to use it with Memento, since there's no Web browsing going on. That Web browsing stuff is most of what JS was designed for, but all we need are the basic programming language statements out of it.
Note if you take the Grasshopper courses: Grasshopper teaches a more recent JS than Memento supports. There are 3 statements that don't apply to Memento JS (As you read this now, you shouldn't understand all this. Just hold my info below until you get to these statements in Grasshopper. It'll make sense to you then.):
- The let statement. Just use the var statement instead. It works the same way for our purposes.
-
The const statement. Just use the var statement instead. It works the same way for our purposes.
- The for...of statement. Use the older for...in statement instead. Here's an example of how they're different, so you can still use it in the course:
- The for...of statement improved & simplified the older for...in statement.
- Using for...of (in newer, modern JS):
- for var x in arrayOfEntries {
- (Your JS code here for your for loop referencing x)
- }
- Using the for...in statement that Memento uses:
- for var y in arrayOfEntries {
- var x = ArrayOfEntries[y];
- (Your JS code here for your for loop referencing x)
- }
Just save this message until you get far enough in the Grasshopper courses where you'll need them. At that point this info will make sense to you, and you can complete the courses using either the newer statements (like in a Web browser or other newer JS) or the older statements in Memento. The differences above don't amount to much, but if you don't know this info, you'll trip over them, if you try to use that newer JS code in Grasshopper with Memento.
If you continue with Memento or other apps or browsers, many of them use JS; it's very popular, so I hope you'll take the courses, maybe get back to forum people like me to share your experiences with your new programming.
Final thing...
Read the Memento Help (most for simple stuff, not for JS). Then read the Memento wiki (wiki.mementodatabase.com) & look for whatever you need. I founded the wiki & am about to renovate it (next few weeks) after 5 years before I retire. Beth Dixon will take it over. Locate the Scripting pages in the index (indexes in the new wiki). Quick hint on it: As of today, there are 4 places JS is used in Memento: JS fields, Actions, Triggers, & Custom Data Sources. The last one of those isn't used nearly as much as the others.
With a JS field, you can access other fields in your library or, if the libraries are linked, fields in the linked libraries as well. A JS field accesses fields, maybe calculates something (like a discounted price), and displays it or uses it in further JS field calculations. JS fields are designed to be very easy to learn & to use. With an action, you can make your own button in the entries list screen or in the entry view screen and have it do what you want. In the entries list, the action script usually goes through all your entries, finds what you want in there, and maybe does something you say to do with them. With a trigger, you can have your JS script invoked when something happens, like when an entry is saved after editing or when a library is opened, and you can do things at that point in the process. With actions & triggers, you have more power, but to be able to use that power, you may have to learn some more things.
Enjoy, and keep us posted, Colin.