CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> GotoCode Archive

 List of Parts Associated with a Product

Print topic Send  topic

Author Message
cnorth
Posted: 10/29/2002, 2:38 PM

Hello,
I'm trying to use CodeCharge to build a rudimentary MRP system. Basically I want to be able to build a bill of materials for a product using a table of parts. I thought the Bookstore example would be a good model for this. Basically the product is like an order and the items in the order are like the parts. I created 3 tables: Products, Parts, and ProductParts. The latter basically creates the many to many relationship for mapping parts to multiple products. The page I've constructed has 3 forms: a product form giving summary info on the product, a parts table listing the parts associated with that product, and a total form that totals the cost of the parts. The problem is that all of the parts in the database show up in each product record. How do I limit the displayed list of parts to just what's associated with that product? I looked through the bookstore example several times and can't see how to do it. Anyone have any suggestions?
Nicole
Posted: 10/31/2002, 2:22 AM

Hello,
You should add Input parameter for the parts form associated with the currently displaying product_id. But as I understand the product_id is not stored in the parts table. So in this case the task is more complicated.
You should retrieve all the part_id from cross table which are referred to given product_id and build Where clause basing on the retrieved values.
The code goes in the Open event of parts form.
Here is sample for PHP with some comments:

//execute custom query to retrieve all parts_id
$db->query("select part_id from parts_products_table where product_id=". get_param("product_id"));
//replace Where with custom default value
$sWhere = "";
//go through the recordset and built Where
while ($db->netx_record())
{
if ($sWhere == "")
$sWhere .= " Where part_id=". $db->f("part_id");
else
$sWhere .= " or part_id= ". $db->f("pasrt_id");
}

   


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.