Options

[Unsolved] Compound primary key for Item table

ForzaForza Member Posts: 64
Anybody have any idea how to setup compound key in Navision? Particularly for Item No.? For instance, making No. + No. 2 to be a compound primary key. How will this affect other tables like sales line, item journal, etc?


Any help will be appreciated. Thanks a million.

Comments

  • Options
    MauddibMauddib Member Posts: 269
    Never ever ever do anything like that ever! Basically Every bit of code in Navision that is Item.GET(something) will not work any more.

    What are you trying to acheive?
  • Options
    mukshamuksha Member Posts: 274
    I am also stuck with the same scenerio:
    My scenerio is:_
    In production order routing line I wanted to create a modified routing for rework operation. System says for filtering correctly that rework boolean field should be part of the primary key. We cant change the primary key of the production order routing line table.

    Let me explain you better:_

    On production order of Item A is released with operation 1,2,3,4 and 5.

    At the time of posting of the operation 4 it has to be sent back to operation 2 or 1.
    At the time of posting output from output journal the user tick the boolean and a routing line is created and machine center/work center Task List is updated.
    Now the particular work center/machine center user can post the output against that particular production order when the rework boolean is ticked on the output journal.

    Please advice!!
    Mukesh Sharma
  • Options
    ForzaForza Member Posts: 64
    Mauddib:
    Never ever ever do anything like that ever! Basically Every bit of code in Navision that is Item.GET(something) will not work any more.

    What are you trying to acheive?
    What happened is we have items with main item code that represents the particular model in the product range. On top of that, we have different material that can be applied to all the models in the product range, with different pricing for each product/material combination. We want to try if it is possible that we manually enter the product model, but then use the secondary key to lookup to a table that store all the material code. And the combination of both will be the primary key.

    This solution was suggested to avoid any double entry of the product/material combination and also to make it easier to create an item. Looking up to a list of pre-defined list is always better than remembering where you left off.

    Any other way anyone can think of that will help solve this situation? Thanks a million.
  • Options
    MauddibMauddib Member Posts: 269
    There is an option on the item card for VARIANTS. You could use that.
  • Options
    mukshamuksha Member Posts: 274
    Yes Variants can be defined but what about the different prices?
    Mukesh Sharma
  • Options
    matteo_montanarimatteo_montanari Member Posts: 189
    muksha wrote:
    I am also stuck with the same scenerio:
    My scenerio is:_
    In production order routing line I wanted to create a modified routing for rework operation. System says for filtering correctly that rework boolean field should be part of the primary key. We cant change the primary key of the production order routing line table.

    It sound like a wrong table relation design. You can only relate a field to an external primary key.

    Something like relate a Manufacturer field -> Item."Manufacturer Code". The correct relation is Manufacturer field -> "Manufacturer.Code"

    Eto
    Reno Sistemi Navision Developer
  • Options
    ForzaForza Member Posts: 64
    Mauddib:

    There is an option on the item card for VARIANTS. You could use that.

    Been there, done that. This option can't work for two reasons.

    1. The cost and price for the different product/material combination must be different. Selling price is not a big issue, but cost is. Because we bought them at different price from the vendor. Without segregating them in the item code level, it is almost impossible to set different cost for different product/material combination.

    2. The Variant Code will be used for finishing color, since all of them is the same cost and selling price.


    Thanks for the suggestion though, Mauddib. But I need a more innovative approach. Anyone out there can't help overcome this M::I?
  • Options
    MauddibMauddib Member Posts: 269
    You could create a No. 3 on the item table so you have No. No.2 and No.3.

    Then hide "No." From the user.

    Whenever 2 or 3 are changed you call the code:

    VALIDATE("No.", "No. 2"+"No. 3");

    So now users can enter their two values but it always gets fed back into the primary key as one compound value.

    Will have to ensure the lengths of 2 and 3 can only be a sum total of 20 characters though.
  • Options
    mukshamuksha Member Posts: 274
    Dear Forza,
    If selli9ng price is not the big issue then you can use Varients. The cost of the item and Varient will be done on the basis of costing method selected on the item card and this is working fine.
    Mukesh Sharma
  • Options
    ForzaForza Member Posts: 64
    You can have different cost for different variant? How will the system calculate?
Sign In or Register to comment.