Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The FooBar thing confuses me so here is my example based on real world objects.</p> <p>ExpenseTransaction has attributes (date, trxDescription, category, amount).</p> <p>Category has a single attribute (name)</p> <p>ExpenseTransaction.category is a To-One relationship to Category (in other words a transaction can belong to only one Category).</p> <p>Category.transactions is a To-Many relationship to ExpenseTransaction (in other words many transactions can belong to the same Category).</p> <p>The UI for creating a new transaction or editing and existing one uses NSPopupButton to display the list of available Categories using the name attribute. For existing transactions the popup will display the selected transactions category.</p> <p>Bindings for the Category popup are as follows:</p> <p><strong>Content</strong> (Category.arrangedObjects)</p> <p><strong>Content Objects</strong> (Category.arrangedObjects) - we want to link to the actual category not its name because the attribute is a relationship not a string value</p> <p><strong>Content Values</strong> (Category.arrangedObjects.name) - we want the name to be displayed in the popup list</p> <p><strong>Selected Object</strong> (ExpenseTransaction.selection.category)</p> <p>Using your FooBar analogy:</p> <p>Category has a relationship to ExpenseTransaction, so Category has a property (transactions) that is a NSSet of ExpenseTransactions. Now this is pretty much the inverse of my arrangement so I don't really know how or why you would populate the popup with ExpenseTransaction objects because only one selected item in the popup could be related to the Category object when in fact you need the whole set to be related. However the other way around works just fine because the popup would contain a list of all the Foo items and so whenever you select a Bar item the corresponding Foo item could be selected from the popup.</p> <p>Hope this makes sense.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload