Jump to content

This topic is 8551 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

i have created files for suppliers, products and supplier_products. in the supplier_products file i want to restrict the data to only 1 instance of supplier and product. ie i want to create a combined primary key of the foreign keys supplier_code and product_code.

eg

supplier_a,prod_a

supplier_a,prod_b

supplier_b,prod_a

if the user enters supplier_a,prod_a again i want an error to occurr due to file validation.

if that makes any sense to you i would appreciate your help. smile.gif" border="0

Posted

2 very easy way to accomplish this, and 1 caution.

First the caution, do NOT make this the primary key. ALWAYS make your Primary (thus Foreign) keys out of non-user enterable/editable data. I simply use an ID scheme that I detailed in a FAQ at http://www.fmforums.com/ubb/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=8&t=000018

As far as the user is concearned this field can be the primary identifier, but do not make the mistake of believing this yourself.

Ok, now you can validate this many ways, the two easiest are: field validation, requiring that the field be a unique value and giving the user a message that indicates what has happened and how to fix it; the other way is to do your data entry into global fields, then validate that entry with scripting. The second option is more work, but you get alot more control over how to deal with the error.

This topic is 8551 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.