[baseten-users] Fwd: Using relationships with binding

Réjean Lamy rejean.lamy at mac.com
Thu Apr 23 18:35:51 EEST 2009


One more thing...

I just finished porting the Department-Employees example with success.
The only thing I cant do is to display "No value" in the manager popup  
when the manager employee moved to an other department.

I explain:

When an employee whas selected as the department manager and is later  
deleted, the manager popup display "No Value".
This is ok and I experiment the same behavior on both the CoreData and  
BX versions of the application.

However, when an employee is selected as the department manager  and  
later I moved the employee to another department,
this time, the manager popup display the expected "No value" in the  
CoreData version, but display

"<BXDatabaseObject(0x15503ff0) pgsql://localhost/depts/public/Employee?id,n=2 
  fault: 1>"

in the BX version of the application.

I understand the displayed string is related to the manager  
relationship no longer point to an existing employee in selected  
department.

But, how I can fix that (via IB or coding) so the manager popup  
display "No value" instead  ?

Finally, is there an ftp location where BX users can share simple  
examples like this.
I suggest BX staff to put in place such code sharing facilities  
specially for the BX community (and a forum maybe).

Thanks

Rejean Lamy




Début du message réexpédié :

> De : Réjean Lamy <rejean.lamy at mac.com>
> Date : 22 avril 2009 19:05:40 HAE
> À : BaseTen-Users <baseten-users at lists.basetenframework.org>
> Objet : Rép : [baseten-users] Using relationships with binding
>
> Thanks for the quick feedback Tuukka
>
> Following your recommendations and using the key name  
> "public_Employee_department" (instead of the model name "employees"  
> relationship) now all binding are ok.
> Looking forward for version 1.6.3 with more examples.
>
> Thanks !
>
> Rejean Lamy
>
>
>
>
> Le 09-04-22 à 08:54, Tuukka Norri a écrit :
>
>> Hi!
>>
>> Réjean Lamy kirjoitti 21.4.2009 kello 15.43:
>>> The first problem  was with one-to-many relationship field and  
>>> NULL value. I  manually edited the table to allow the relationship  
>>> field to accept NULL.
>> This is a bug in BaseTen Assistant (http://basetenframework.org/ticket/179 
>> ). It should be fixed in SVN trunk but we'd like to do some more  
>> tests.
>>
>>> But now my second problem is about using relationship with binding.
>>>
>>> Is it correct with BX to use Array Controllers for the  
>>> ManagerPopUP, EmployeeList (Department View) and DeptPopUp  
>>> (Employee View) ?
>> Yes. You'll probably want to use BXSynchronizedArrayControllers,  
>> though, since they are able to fetch objects from the database and  
>> change their content based on notifications received from the  
>> database.
>>
>>> Is It ok for these controllers  to be in "Entity mode" with  
>>> "Automatically Prepare Content ?
>> No. BXSynchronizedArrayController shouldn't even expose these  
>> options. Instead, it does have an option called “Fetch on Connect”;  
>> it does work quite the same way as Automatically Prepare Content,  
>> though.
>>
>>> What is the correct binding for these controllers ?
>> They should be bound like in Hillegass's example. The Managed  
>> Object Context binding isn't used (and isn't available), but  
>> databaseContext outlet needs to be connected.
>>
>>> What is the correct key path for a relationship ? (trying the Data  
>>> Model name and the "other table" name don't work).
>> In BaseTen 1.6.2 one could use the target table's name to reference  
>> a relationship, if that particular relationship is the only one  
>> between the tables. Obviously this won't work in the Department- 
>> Employee example. The foreign keys' names can also be used (see  
>> sections 2.2.1 and 2.2.2 in the manual), but for BaseTen 1.6.3 we  
>> changed this a bit so that both the relationship's and the inverse  
>> relationship's name will work as specified in the Xcode data model.
>>
>> We'll probably add some functionality to list the relationships  
>> into BaseTen Assistant. Meanwhile, there is a command-line tool  
>> called Introspection in our source repository (see http://basetenframework.org/browser/trunk/Examples/Introspection) 
>>  for this purpose.
>>
>> We'll write some more examples as soon as we're done with version  
>> 1.6.3!
>> -- 
>> Best regards,
>> Tuukka Norri
>> MK&C
>>
>> _______________________________________________
>> baseten-users mailing list
>> baseten-users at lists.basetenframework.org
>> http://lists.basetenframework.org/mailman/listinfo/baseten-users
>




More information about the baseten-users mailing list