> How do I filter/sort contacts by the 'State' condition in the State library?
Create JavaScript field in Contacts with this script...
// Assumes link to city in Contacts is City and link to state in Cities is State
field("City")[0].field("State")
Now, you have a field in Contacts using which you can sort, filter, and group.
> Another semi-related question is how does Memento really link the 'States' condition in the 'Cities' library? In a truly normalized case, it would contain a link to an ID, but Memento seems to just be copying the 'State' verbatim to the 'Cities' database. Is it not a true RMDB in this manner? (As long as it works, I don't care much, but I just want to make certain I'm not overlooking something simple. Does Memento have the tools to handle normalized DBs with some type of SQL like queries, or can the equivalent be done with Javascript?)
First, I've been almost entirely unable over the years to have a rational conversation about relational database theory with anyone. Everyone comes from a different walk of life, with different models and success stories in their minds, and they all tend to be very religious about it. So, I'll say that it's pretty damned relational, that Oracle, DB2, Sybase, etc each have their quirks underneath the relational mantle. However, though there could be, there is no SQL engine within or over the top of Memento, and many folks use things in Memento that go beyond relational, like many-to-many links.
Anyway, underneath, there is a relational engine that uses IDs for physical storage, but the real answer is that at the logical level, a link is to an "entry name", which is built from the field role set on defined fields. An entry name is quite like a primary key, and one can set a library to enforce uniqueness of entry names, which enables relational features. It does no "storing" like you suggest.
There is no query engine. The power of Memento comes from its user interface, from the slice'n'dice features of aggregation, sorting, filtering, grouping, and charting, and from extension via JavaScript features and libraries.
...It does no "storing" like you suggest...
...I will think about the above Javascript in relation to this some more...
I assume the answer on the deepness question is "Yes". It is better to break the Javascript into sections in each D B, to reduce the update calculations in the final table.
Again, a huge thanks for your time!