Stock list, help

Hello, I have 3 lists: pencils, books, rucksacks. Now I need to make the stock list, with three elements: kind, item, amount. Kind is a dropbox, with 3 values: pencils, books, rucksacks. I would like that If I choose pencils the element “item” will take values from pencils list, if I choose books the element “item” will take values from books list...and so on. Thanks for your attemption! ;)
 
You can try to change item element to calc element.
Then write your query and use selected value from kind element, then return needed info.
 
That's not going to work.

Typically, you'd have a single combined products table, with a product_type ...

product_type table:
id, type
1, Pencil
2, Ruck Sack
3, Book

product table:
id, product_type, sku, price, description
1, 1, 122, $2, No 2 pencil
2, 1, 123, $2, No 3 pencil
3, 2, 124, $10, Black Ruck Sack
4, 2, 125, $10, Red Ruck Sack
5, 3, 127, $10, Pride & Prejudice
6, 3, 128, $12, War & Peace

stock table:
id, product_type, product, qty
1, 1, 1, 10 // type 1 (pencil), product 1 (No 2 pencil), 10 qty
2, 1, 2, 5 // type 1 (pencil), product 2 (No 3 pencil), 5 qty
3, 2, 3, 8 // type 2 (Ruck Sack), product 3 (black ruck sack), 8 qty
4, 2, 4, 6 // type 2 (Ruck Sack), product 4 (red), 6 qty
5, 3, 5, 20 // type 3 (book), product 5 (Pride & Prejudice), 20 qty
etc

Then you can use a join for the product_type, and a CDD for the product.

What you can't do is have a "variable" join which points to different tables.

-- hugh
 
That's not going to work.

Typically, you'd have a single combined products table, with a product_type ...

product_type table:
id, type
1, Pencil
2, Ruck Sack
3, Book

product table:
id, product_type, sku, price, description
1, 1, 122, $2, No 2 pencil
2, 1, 123, $2, No 3 pencil
3, 2, 124, $10, Black Ruck Sack
4, 2, 125, $10, Red Ruck Sack
5, 3, 127, $10, Pride & Prejudice
6, 3, 128, $12, War & Peace

stock table:
id, product_type, product, qty
1, 1, 1, 10 // type 1 (pencil), product 1 (No 2 pencil), 10 qty
2, 1, 2, 5 // type 1 (pencil), product 2 (No 3 pencil), 5 qty
3, 2, 3, 8 // type 2 (Ruck Sack), product 3 (black ruck sack), 8 qty
4, 2, 4, 6 // type 2 (Ruck Sack), product 4 (red), 6 qty
5, 3, 5, 20 // type 3 (book), product 5 (Pride & Prejudice), 20 qty
etc

Then you can use a join for the product_type, and a CDD for the product.

What you can't do is have a "variable" join which points to different tables.

-- hugh

I have understood your solution, but there is a problem. Books can have different features, for example Books can have element “number of pages” and pencils don’t need this element. Rucksacks for example can have element “fabric type”. For this reason I thought that was better to split products in 3 lists. Do you think I’m wrong??
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top