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");
Answers
Shortcut Dimension 5 does not normally exist, so it must be customization. You will need to check with who ever added that code.
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
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")
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
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
Can you put [solved] in the subject by editing your first post?
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog