Hello BDB guru!
I new user, and try BDB. And of course have questions.
I can not understand how to organize a complicated relationship.
All Manufacturers produce all Products
To link Products to Manufacturer, I use many-to-many relations. But each Manufacturer has its own price for each Product.
Task is to choose Manufacturer of the Product with best price.
I can not understand how to fix the price of the Product for each Manufacturer in many-to-many field?
And the second question, sorting manufacturers at the best price (but I hope to understand alone how to do it if i find answer of first Q).
Still considering options but one idea might be 3 forms (tables) product-product details-manufacturer. The main product form contains all common atributes, the product details contains manufacturer reference, price location etc. The manufacturers contains address contacts etc. With details linked to main product form you can add multiple entries and sort the M-M field for lowest price at top or use math operations IE "MIN" on related field.
Thanks for the answer!
In this example, each product can have an unlimited number of manufacturers.
Products example a wooden board, this board can be done in different sawmills, you must choose the cheapest wooden board produced on sawmills.
I think it should work on the principle of invoice logic.
I can make the relationship m2m Manufacturer - Product, but I do not understand how to set different prices for each product.
Thank you David!
I mail to Mikhail. And have the answer.
The model you have described is very common, I call it:
\"Product\" - \"Product In Order\" - \"Order\".
The \"Product\" and \"Order\" - records with many-to-many link to the \"Product In Order\" form. This last form has only one non-relational field - \"Price\".
I have created a simple \"sawmill\" example according to your description.
And I find the problem, why I cant made it.
1. Made 3 forms: "Sawmill", "Product", "Product In Sawmill"
2. Add "Price" number field to "Product In Sawmill" and delete default "Title" text field
3. If I add M2M relationship I do not see the "Price" on table slyle.
But if I add first M2M relationship field and then add "Price" number field to "Product In Sawmill" and delete default "Title" text field now I can see an can select "Price" field on table slyle on relationship field setings.