Using KVC operator e.g., @unionOfSets/@sum in IB's Value Binding Model Key Path
I am not sure if this can be done -- it looks like it should be a straightforward thing but I keep getting "the entity Sale is not key value coding-compliant for the key "@sum"."
开发者_运维百科I using "@unionsOfSets.departments.@sale.amount" for the Table column value binding. I am doing it right, or what is the right way to do this?
First, take an other look at the KVC Programming Guide's Set and Array Operators section. KVC's set and array operators are powerful, but it's easy to get them wrong, even after you've grokked the system. And it's nearly impossible to get them right until you do.
That said, I think you mean you used "@unionOfSets.departments.@sum.amount"
since you say the error involves @sum
, and @sale
isn't a legal KVC operator. Assuming that's right, and that you have a model like foo->*departments->*sales.amount, you probably want something like
"@sum.departments.@sum.sales.amount"
to get the total sales for all departments.
精彩评论