Dimension update in the record

memulamemula Member Posts: 30
edited 2005-01-29 in Navision Attain
The task is:
I have new created form-card with 2 glob. dimensions. Also i've made
code in those triggers onValidate() to get descriptions of the dimensions.
When i change them dirctly on the form it's work ok, but when i try to update them from "default dimensions" form onValidate() triggers dose not
work and descriptions stay empty. Maybe somebody knows how can i solve this problem.

pre Thanx. :)

Comments

  • ArhontisArhontis Member Posts: 667
    Hi,

    How do you update the values in "default dimensions"?
    Do you use the VALIDATE function?
  • memulamemula Member Posts: 30
    I use the function in the form "Default Dimension 352"

    UpdateGlobalDimCode(GlobalDimCodeNo : Integer;"Table ID" :
    Integer;"No." : Code[20];NewDimValue :
    Code [20])

    I've added a block:
    //
    DATABASE::"Road Vehicle": BEGIN
    IF RoadVehicle.GET("No.") THEN BEGIN
    CASE GlobalDimCodeNo OF
    1:RoadVehicle."Global Dimension 1 Code" := NewDimValue;
    2:RoadVehicle."Global Dimension 2 Code" := NewDimValue;
    END;
    RoadVehicle.MODIFY(TRUE);
    END;
    END;
    //
    first i try to do in such way
    ...
    ..
    1:RoadVehicle.VALIDATE("Global Dimension 1 Code",
    NewDimValue);
    2:RoadVehicle.VALIDATE("Global Dimension 2 Code",
    NewDimValue);
    ....
    ..
    ..
    but my SQL server speak that , somebody change my dimension when i
    start activity ! bla bla bla bla bla bla
    :)

    now i do not know what to do...
  • ArhontisArhontis Member Posts: 667
    Could you please post the code of the OnValidate function of one of your global dim fields in the roadvech... table?
  • memulamemula Member Posts: 30
    //
    RoadVeh table
    Global Dimension 1 Code - OnValidate()

    ValidateShortcutDimCode(1,"Global Dimension 1 Code");
    ClM.GetDimDesription(1,"Global Dimension 1 Code",Dim1Caption);
    MODIFY;

    CLM - that is Code unit where i get dim name , but there only reading
    tables , no any modification at all.
    //

    ValidateShortcutDimCode(FieldNumber : Integer;VAR ShortcutDimCode :
    Code[20])
    DimMgt.ValidateDimValueCode(FieldNumber,ShortcutDimCode);
    DimMgt.SaveDefaultDim(DATABASE::"Road
    Vehicle","No.",FieldNumber,ShortcutDimCode);

    DimMgt -> that is "Dimension Management CU 408
    //

    and there is a error message , when i try to change dimension in "Default Dimension form"
    But I don't now how you can get it , because I first time on this forum.
    :|
    May be i can send you an e-male ?

    And sorry for wrong name in subject of first reply, I had friend called Athens and i've typed it automaticly.
  • ArhontisArhontis Member Posts: 667
    You should delete the modify call from one of the functions, the error you get from sql is that you try to modify a rec two times...

    I suggest you delete the MODIFY from the OnValidate routine and call the Validate from the default dimension...
  • memulamemula Member Posts: 30
    Sorry Arhontis, but i've made just like you suggest and i still have
    the same error.
    I sand it to you.
    :|
  • kinekine Member Posts: 12,562
    What have you in OnModify trigger on your table ""RoadVehicle"?

    Don't you call the function ValidateShortcutDimCode?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ArhontisArhontis Member Posts: 667
    Maybe you haven't closed and open the form so that it would load the new version of the object??

    Just in case, close the app and reopen it...

    If that doesn't work then look and replicate the code that is in the:
    UpdateGlobalDimCode(GlobalDimCodeNo : Integer;"Table ID" : Integer;"No." : Code[20];NewDimValue : Code[20])
    
  • memulamemula Member Posts: 30
    Hi Kine !

    I have nothing in the OnModify(), it is empty.

    I think that trouble is when server attempt to execute code in Dimension
    Management CU.

    But i can't find it due to debugger.

    :(
  • kinekine Member Posts: 12,562
    What is debugger doing? Where stop? Why you are not able to catch the point?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • memulamemula Member Posts: 30
    I've reconnect to the server , it dosn't work.

    Sorry Arhontis, but my english is poor , what do you mean
    "replicate code" ?
  • memulamemula Member Posts: 30
    :( I'm just a beginner in Navision Developing.
    It very strange it work on my local DB , but didn't work on the server,
    now i try to get a developing license to work on the server directly.
    It let me debug the problem.
    :)
  • kinekine Member Posts: 12,562
    It is normal: On Native DB (local DB) is it working and on MS SQL server you have error "Another user changed etc." - it is because different locking type (optimistic vs. recordlocking)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • memulamemula Member Posts: 30
    Now i will know , thanx Kine
  • memulamemula Member Posts: 30
    Guys , you can congradulate me. I found a problem. :D
    But anyway i should say big thanx to you all for helping me.
    first i could not to debug my code on the server.
    Now i'v got a license to do it.

    The problem was:
    function wich read Dimension Names from a table should not be executed
    while SQL make changes in default dimension table. That is whay i could not find a problem a long time. I thought that it only read table with dimension , but i forgot that at the same time SQL try to save it. And
    the reason is
    SQL DETECTS A DEADLOCK !

    I decide do not make reading dim. names in function Global dim Code OnValidate() in my table RoadVeh and
    made it in table Default Dimension before it save .

    Greetings from Latvia
Sign In or Register to comment.