Dimension not update in G/L entry

yvonneyvonne Member Posts: 31
edited 2007-08-17 in Navision Attain
I need to populate default dimension value into "Shortcut Dimension 5" in Journal Entry based on Account No entered by user.

I have no problem to display the dimension value in Journal Entry, however the dimension value is not update in Journal Line Dimension table. (Journal Entry - line button - dimension is emtpy).
Account No - OnValidate()
.....
IF ("Account No." = '80') OR ("Account No." = '73') THEN BEGIN
   BankAccPosting.RESET;
   BankAccPosting.SETFILTER(BankAccPosting.Code,BankAcc."Bank Acc. Posting Group");
   IF BankAccPosting.FIND('-') THEN BEGIN
      "Shortcut Dimension 5 Code" := BankAccPosting."G/L Bank Account No.";
       Validate("Shortcut Dimension 5 Code");
   END;
END;

Shortcut Dimension 5 Code - OnValidate()
CheckBankCashFlow;
ValidateShortcutDimCode(5,"Shortcut Dimension 5 Code");

Please advise & thank you very much #-o

Answers

  • David_SingletonDavid_Singleton Member Posts: 5,479
    yvonne wrote:
    I need to populate default dimension value into "Shortcut Dimension 5" in Journal Entry based on Account No entered by user.

    I have no problem to display the dimension value in Journal Entry, however the dimension value is not update in Journal Line Dimension table. (Journal Entry - line button - dimension is emtpy).
    Account No - OnValidate()
    .....
    IF ("Account No." = '80') OR ("Account No." = '73') THEN BEGIN
       BankAccPosting.RESET;
       BankAccPosting.SETFILTER(BankAccPosting.Code,BankAcc."Bank Acc. Posting Group");
       IF BankAccPosting.FIND('-') THEN BEGIN
          "Shortcut Dimension 5 Code" := BankAccPosting."G/L Bank Account No.";
           Validate("Shortcut Dimension 5 Code");
       END;
    END;
    
    Shortcut Dimension 5 Code - OnValidate()
    CheckBankCashFlow;
    ValidateShortcutDimCode(5,"Shortcut Dimension 5 Code");
    

    Please advise & thank you very much #-o

    Shortcut Dimension 5 does not normally exist, so it must be customization. You will need to check with who ever added that code.
    David Singleton
  • WaldoWaldo Member Posts: 3,412
    David is right.

    Normally, in journal tables, you only have Shortcut Dimension 1 and 2 (the so called "global" dimensions). If you check these fields, you'll se there is some code in the OnValidate-trigger: e.g.:
    ValidateShortcutDimCode(1,"Shortcut Dimension 1 Code");

    So, you probably added a new field "Shortcut Dimension 5 Code" in your Journal table. You'll have to put this code OnValidate:
    ValidateShortcutDimCode(5,"Shortcut Dimension 5 Code");

    For the LookUp, you'll have to define a TableRelation:
    "Dimension Value".Code WHERE (Global Dimension No.=CONST(5))
    For this to work, make sure the field "Global Dimension No." in the table "Dimension Value" is automatically filled in for non-global dimensions as well. for this: modify the OnInsert & OnModify trigger of table "Dimension Value".

    In table "Journal Line Dimension", you should modify the OnInsert, OnModify and OnDelete trigger to update your new shortcutdimension as well.

    You see it's not just "adding a new field", but it involves some programming.
    Is this enough info?

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • yvonneyvonne Member Posts: 31
    Thank you for reply. As i am beginner therefore not great understand dimension workflow.

    Yes, It is customise field in journal entry form. These are the codes i added in table Gen. Journal Line.

    I don't understand why system can capture Dimension value if I enter the value code manually or select from lookup list, but system fail to capture the dimension value if i pass in Account No-On Validate, as from coding i paste did add validation function in Shortcut Dimension 5 Code -Onvalidate

    ValidateShortcutDimCode(5,"Shortcut Dimension 5 Code")
  • WaldoWaldo Member Posts: 3,412
    Well,
    there is also a function "CreateDim" in the Gen. Journal Line table.
    This function is called OnValidate of the field "Account No".
    You'll need to add some code to also insert/update the Shortcut Dimension 5 Code field.
    :-k

    Or ... just update the OnValidate trigger with code to insert/update your new field.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • yvonneyvonne Member Posts: 31
    Hi Waldo, thanks for helping hand... you remind me "Create Dim" function in Gen. Journal Line table.

    I add VALIDATE("Shortcut Dimension 5 Code"), after "Create Dim" function on "Account No." field. It solved all problem. All dimension value update accordingly.

    Thank you very much :D
  • WaldoWaldo Member Posts: 3,412
    I'm glad to hear this ... 8).
    Can you put [solved] in the subject by editing your first post?

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • yvonneyvonne Member Posts: 31
    Thank you for guidance. :D
Sign In or Register to comment.