CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 solving a many-to-many relation with CC

Print topic Send  topic

Author Message
robert
Posted: 07/08/2002, 4:45 AM

Help!!!

I am having some troubles with creating and updating a ("product") table which has a many-to-many relationsship to a "category" table:

------
A table relationship such as
"product<-N---1->category" (a product belongs to only one category)
with the fields:

product=id,name,category_id
category=id,name

... doesn't cause any problems. I simply create a field "category" within the 'product-table' form with type 'listbox' and set the appropriate 'list' properties.

------
B U T what can be done in a table relationship such as
"product<-N---N->category" (a product can belong to more than one category)???
I created the following db tables:

product=id,name
matchproductcategory=id,product_id,category_id
category=id,name

... which equals:
"product<-N---1->matchproductcategory<-1---N->category"

------
NOW, how could I solve this category assignment (within the 'product' form/page) in CC2.0 (asp or php)???
Did somebody have had a similar situation and did find a solution; or do you have a idea how to program this case?

Thanks a lot for any help!!

Robert


Chris K.
Posted: 07/08/2002, 6:03 AM

If you want only to assign a category to the product edited the best solution would be to either put a HTML label field and populate it in Before Show event with checkbox for each category.
Just open recordset with SELECT * FROM category query, iterate the result appending checkbox with unique name (appending category_id to name) and category label. You can mark existing relations checked (by left joining matchproductcategory in the query and checking not null). You will have to handle submit yourself and process again all categories checking if some were checked (INSERT INTO... if there wasn't) or unchecked (DELETE FROM... if there was).

Another solution could be to make a form with only listing current assigned categories in the label field (again subrecordset iteration) and making link to categories selection on another page (submitable grid wih checkboxes and product_id input parameter). Grid would add or remove relations on submit (according to checked or unchecked checkboxes). Put link to come back to product page.
Manny ramirez
Posted: 12/07/2003, 9:34 PM

Can you email me your solution, I am trying to do something similar without any luck.
Email tomramirez@bigpond.net.au

Thanks
Manny

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.