Get Dimension Set ID from Dimension set entry

darmaadarmaa Member Posts: 65
edited 2014-10-21 in NAV Three Tier
Hello All,
Please help my below customization.
How can I filter that DimSetEntry."Dimension Value Code" and shortcut 1|shotcut 2? I need dimension set ID filtered by DimSetEntry."Dimension Value Code" and shortcut 1|shotcut 2. But I cant take correct dimension set id shown in attached image.

DefaultDim.RESET;
DefaultDim.SETFILTER("Table ID",'5200');
DefaultDim.SETFILTER("No.",Employee."No.");
DefaultDim.SETFILTER("Dimension Code",'COST CENTER');
IF DefaultDim.FINDFIRST THEN BEGIN
PayrollLine."Shortcut Dimension 1 Code" := DefaultDim."Dimension Value Code";
END ELSE PayrollLine."Shortcut Dimension 1 Code" :='';

DefaultDim.RESET;
DefaultDim.SETFILTER("Table ID",'5200');
DefaultDim.SETFILTER("No.",Employee."No.");
DefaultDim.SETFILTER("Dimension Code",'SITE');
IF DefaultDim.FINDFIRST THEN BEGIN
PayrollLine."Shortcut Dimension 2 Code" := DefaultDim."Dimension Value Code";
END ELSE PayrollLine."Shortcut Dimension 2 Code" :='';

ValidateShortcutDimCode(1,PayrollLine."Shortcut Dimension 1 Code");
ValidateShortcutDimCode(2,PayrollLine."Shortcut Dimension 2 Code");

DimSetEntry1.RESET;
DimSetEntry1.SETFILTER("Dimension Value Code",PayrollLine."Shortcut Dimension 1 Code",PayrollLine."Shortcut Dimension 2 Code");
IF DimSetEntry1.FINDSET THEN REPEAT
PayrollLine."Dimension Set ID":=DimSetEntry1."Dimension Set ID";
UNTIL DimSetEntry1.NEXT=0;

Comments

  • BardurKnudsenBardurKnudsen Member, Microsoft Employee Posts: 137
    I am not familiar with your payroll solution, but from the naming of the ValidateShortcutDimCode function, I suspect that it works similar to the General Journal Line table (table 81).
    In table 81 the function is define like this:


    ValidateShortcutDimCode(FieldNumber : Integer;VAR ShortcutDimCode : Code[20])
    DimMgt.ValidateShortcutDimValues(FieldNumber,ShortcutDimCode,"Dimension Set ID");

    As you can see from the highlighted parameter, the "Dimension Set ID" is updated in this function, and you don't need to do that post-processing. If it does not work, I suggest you investigate the ValidateShortCutDimCode() function on the payroll line.
    Bardur Knudsen
    Microsoft - Dynamics NAV
  • darmaadarmaa Member Posts: 65
    Thanks BardurKnudsen,
    It works onValidate() of Employee No. field of PayrollLine table. Now I need take Dimension ID when I calculate a payroll line from page action. Shortcut dimensions can create in payrollLine but dimension set ID cant create. So I validate these dimensions to Dimension set entry then I need take dimension set ID from it. But my setfilter doesnt work. It takes wrong combination`s ID.
  • BardurKnudsenBardurKnudsen Member, Microsoft Employee Posts: 137
    How is your "ValidateShortcutDimCode()" function different from the "ValidateShortcutDimCode()" function in table 81? I think you should investigate there.
    Bardur Knudsen
    Microsoft - Dynamics NAV
Sign In or Register to comment.