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;
0
Comments
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.
Microsoft - Dynamics NAV
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.
Microsoft - Dynamics NAV