Question about Item Dimension

silverferretsilverferret Member Posts: 7
One of our datapeople just loaded a whole bunch of items through a dataport. He populated the Global Dimension 1 Code with a value that I do see in the Dimension Value table (viewing through SQL) but when we look at the items through the NAV form the Dimension appears to not have been set. If we go in and manually set it through the form, it stays. I go back into the Item record (again, viewing through SQL) and I see NO difference to the record. Same code is in Global Dimension 1 Code.

I am assuming that there is a table somewhere that I am missing, but I haven't been able to find it.

Did search the forum before posting, but while I found a lot of questions about Dimensions, I didn't find anything about "where" this info is stored.

Any help would be appreciated... I have many years of programming experience, but this is the first time I have seen NAV.

Thanks.

Answers

  • kinekine Member Posts: 12,562
    Look for table Default Dimension.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • silverferretsilverferret Member Posts: 7
    Kine, that is what I was looking for, thank you.

    So I am assuming that the correct way to do this then would have been to have some C/AL code in the dataport that created the entry in the Default Dimension table as well as inserting the Item.

    I will do a search of the forum to look for some code, but please feel free to "steer" me if that is not the correct direction.

    Thanks again for the help.
  • SavatageSavatage Member Posts: 7,142
    very rough but something like this perhaps

    Onafterimport()
    DefaultDim."Table ID" := '27';
    DefaultDim."No." := Item."No.";
    DefaultDim."Dimension Code" := //"Item" or whatever you call yours;
    DefaultDim."Dimension Value Code" := Item."Global Dimension 1";
    DefaultDim.INSERT(TRUE);

    personally I would go for importing into variables and assigning them later. Probably you should slap a validate on the code above too.
    so i would make lines like
    DefaultDim."Dimension Value Code" := varGlobalDim1;

    that's here nor there
  • silverferretsilverferret Member Posts: 7
    Fantastic! I will play around with the example and dev and see if I can get it working.

    Thanks a lot guys!
  • DenSterDenSter Member Posts: 8,307
    I'm pretty sure that the system will create the Default Dimension for you when you validate the Global Dimension 1 and 2, but I'd have to check the code.
  • SavatageSavatage Member Posts: 7,142
    DenSter wrote:
    I'm pretty sure that the system will create the Default Dimension for you when you validate the Global Dimension 1 and 2, but I'd have to check the code.

    I would think so..I've never had to force a GD1 or 2 ever..
    Must be missing a validate somewhere in the dataport.
  • kinekine Member Posts: 12,562
    To have correctly filled default dim, you need correctly create the record in Item table. You need to insert the empty record first and after that validate the fields and do Modify in this way:
    Item.INIT;
    Item."No." := ''; //or your imported value
    Item.INSERT(True);
    Item.VALIDATE(xxxx);
    ... //Filling the values
    Item.MODIFY(True);
    

    If you are filling the fields before you call insert, NAV will not fill the Default dim table, because in this situation the PK of the record is not known... (e.g. because it is filled in OnInsert when No. series is used)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.