September 5, 200124 yr 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.
September 5, 200124 yr 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.
Create an account or sign in to comment