related records deletion

A place for users and developers of the Xataface to discuss and receive support.

related records deletion

Postby entr04y » Thu Nov 15, 2012 5:29 pm

I have xataface 2.0 (downloaded from svn trunk earlier today) and have not fiddled with permissions and don't require a login to my app. When I go into a record relationship, select the record and hit the remove button, there is no question on the resulting dialog about deleting the related record:
Like so:

Are you sure you want to remove the following records from the relationship 'Claims'?

05/29/12 $140.89

With a single remove button.

When I click on remove, the record is removed from the relationship *AND* deleted from the table. I'm pretty sure this was working properly yesterday. Since yesterday, I've also added the htmlreports and ckeditor modules. I need to be able to remove items from a relationship without deleting them from the originating table... any idea what could be causing this behavior?

Thanks!
entr04y
 
Posts: 10
Joined: Thu Oct 08, 2009 6:44 am

Re: related records deletion

Postby shannah » Sat Nov 17, 2012 1:35 pm

If the relationship is one-to-many, then it will actually remove it from the table. If it is many to many it should give you the choice. Can you post the relationship definition from the relationships.ini file?
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: related records deletion

Postby entr04y » Sun Nov 18, 2012 6:15 am

It is a one to many relationship:

[Services]
Services.claim_id = "$claim_id"
actions:addexisting = 1

If there is a way to override that behavior (remove the relationship only instead of delete the row) I'd like to use it...

By way of explanation, the application is to help me to keep track of medical expenses and for these tables the use case is that a provider does a "Service" and sends a "Claim" to the insurance company. The insurance company then pays/negotiates the amount the provider sent in the claim, after which the provider sends a "Bill". There is not a strict correlation (and often no correlation) between what the insurer and the provider do with the billing... hence the need for this application ;) The way I've built this the service gets associated with both the Bill and the Claim in a one to many relationship (each Claim can have many services, but the services will only appear on one claim, and the same for the bills.) If I attache a service to the wrong claim or bill, then delete the service from the relationship, deleting the service row then changes the the other entity...
entr04y
 
Posts: 10
Joined: Thu Oct 08, 2009 6:44 am

Re: related records deletion

Postby shannah » Mon Nov 19, 2012 9:15 am

Currently there isn't a way to override this. I presume that the appropriate action here would be to set a field to NULL in the related record rather than deleting the record. You'll probably need to create a custom action for this, or just have them remove the related record by setting the field to null manually.
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved