Results 1 to 6 of 6

Thread: Relations?

  1. #1
    Join Date
    Feb 2014
    Posts
    3

    Unanswered: Relations?

    Hello BDB guru!
    I new user, and try BDB. And of course have questions.
    I can not understand how to organize a complicated relationship.
    For example:
    Folder "Product"
    Product 1
    Product 2
    Product 3
    Folder "Manufacturer"
    Manufacturer 1
    Manufacturer 2
    Manufacturer 3
    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).

  2. #2
    Join Date
    Sep 2011
    Location
    Australia
    Posts
    264
    Provided Answers: 2
    Hello
    I was going to suggest using multiple relation sets but need to give this some more thought.
    How many manufactures do you expect for each product?
    Regards
    David
    Last edited by tamcind; 02-14-14 at 05:33.

  3. #3
    Join Date
    Sep 2011
    Location
    Australia
    Posts
    264
    Provided Answers: 2
    Hi Again
    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.
    Regards
    David

  4. #4
    Join Date
    Feb 2014
    Posts
    3
    Hello, David!
    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.

  5. #5
    Join Date
    Sep 2011
    Location
    Australia
    Posts
    264
    Provided Answers: 2
    Hello
    Yes looking at it like orders or invoices with line items for details seems like it might work.
    Have included a 5 min build of rough file (very rough but just to show ideas).
    Regards
    David
    Attached Files Attached Files

  6. #6
    Join Date
    Feb 2014
    Posts
    3
    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.

    I hope that it will be useful.
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •