Relationship Difficulties [SOLVED]

Archived from the Xataface Users forum.

cantlep — Wed Mar 17, 2010 6:25 pm

Hi Again, Sorry..I seem to be taking up a lot of time on this board

I’ve created what I think is a many-many relationship…but something is still not working properly (there’s a surprise).

I have two normal tables “SiteData” and “ContractData” and a thrid table (to handle the relationship) called “SiteData_ContractData”

In ContractData I want to be able to create a new contract and have a list of Sites made available (pulled from SiteData) that could be a member of that contract. I’ve created a relationship so that the Sites appear with checkboxes next to them (great). I can select any number of them and create the contract. All is well.

However….

If I create another contract I’m unable to re-use those Sites I used previously…and I really need to be able to allow Sites to be members of multiple contracts (It actually says they’ve been successfully added - but they really haven’t). I did have a weird issue at one point of this feature creating duplicate Sites in “SiteData” but it’s stopped now (which is good) (possibly because I messed with the UNIQUE key).

tables/ContractData/fields.ini

Code: Select all
[SiteName] widget:label = "Site Name" widget:question = "Select one or multiple sites for this contract" transient=1 relationship=SiteData widget:type=checkbox widget:columns=5 validators:required = true

tables/ContractData/relationships.ini

Code: Select all
[SiteData] SiteData_ContractData.ContractRecordID="$ContractRecordID" SiteData_ContractData.SiteName=SiteData.SiteName

Have I messed something up that you can see?

Thanks again.

Paul


cantlep — Thu Mar 18, 2010 3:04 am

All sorted - Composite key issue (checked with a DBA at work )

Cheers