Problems with creating Relationship


Author
Message
Ulrik Mueller
Ulrik Mueller
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 59
In my current startup project on StrataFrame - i'm trying out with something very simple, but i'm getting stuck on creating a foreign key relationship between two tables.

I keep getting "There is no primary or candidate keys in the referenced table 'customer' that match the referencing column list in the forwign key 'fk_co_zip'"

BO1:  Customer - cu_number (PK), cu_name, cu_zip_number

BO2:  Zipcodes - zip_number (PK), zip_text

I'm trying to make a foreign key between cu_zip and zip_number.

I'm running on MS SQL 2005 Express Edition.

Hope that some of you can come up with the gold answer (i'm sure it is stragiht forward and simple)

Best regards

Ulrik Müller

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, if you are getting this error when you save, then this is not on the SF side.  However, in this case, it would just be a matter of opening the designer for the BO2 class (double click the BO2 class in the Solution Explorer).  There is a property called ParentRelationship.  Use the type editor (click the ellipsis button on that property) and setup the relationship between the two.  Then once you drop on an instance of each of these BOs, you will set the ParentBusinessObject property of BO2 to the instance of BO1.  That's it.  There are many samples on this including the StrataFlix sample.  There is also a lot of documentation on this as well.

If you are getting an error when you save, then there may be something going on data side.  But in regards to setting up a BO relationship, that is all that is necessary.

Ulrik Mueller
Ulrik Mueller
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 59
Hi Trent

Thank you for the answer.  I'm having this problem in the DDT.  I am defining the two tables and want to define a relationship between on the ZIPCODE field.

As such this is also ok, but when I ask the DDT to deploy it to my SQL server - i'm getting the error!!!

Regards

Ulrik

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.7K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Ulrik,



Are you deploying data also? Or is there existing data? My first guess would be that you have existing data that violates the FK. If there is existing data that currently violates the FK, you'd likely need to use a pre-script to fix this. Then the FK could be deployed with no problem.
Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, you are welcome to post your PKG file so I can see the error you are facing so that we aren't missing anything.  But Greg had a valid question as well.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search