Get Dimension Set ID from Dimension set entry
darmaa
Member Posts: 65
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;
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
-
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 NAV0 -
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.0 -
How is your "ValidateShortcutDimCode()" function different from the "ValidateShortcutDimCode()" function in table 81? I think you should investigate there.Bardur Knudsen
Microsoft - Dynamics NAV0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 333 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions