Sales Statistics report with Shortcut Dimension 1 Code

Aravindh_Navision
Member Posts: 258
Hi Friends,
Am modifying the existing "Sales Statistics" report (Report ID: 112) to filter the report based on "Shortcut Dimension Code 1". Currently we can filter using "Global Dimension Code 1" and "Global Dimension Code 2" from "Customer" dataitem itself. I need to filter the "Shortcut Dimension Code 1" from Request form.
Actually what need to do is while clicking the ShortcutDimCode1 in request form, it look-ups "Dimension Value" form.
After selecting the Dimension Value in request form, the value should get filter with the "Dimension Value Code" field of "Default Dimension" table. Table ID field is always 18 (pointing Customer table).
Then it must display the corresponding Customers with the same Dimension Value Code.
I have mentioned the coding pieces that I did. I'm getting only 1 "Customer" of the "Dimension Value Code". But I need all the Customers to get displayed.
Can you please point out where I did mistake?
Thanks,
Aarvi.
Am modifying the existing "Sales Statistics" report (Report ID: 112) to filter the report based on "Shortcut Dimension Code 1". Currently we can filter using "Global Dimension Code 1" and "Global Dimension Code 2" from "Customer" dataitem itself. I need to filter the "Shortcut Dimension Code 1" from Request form.
Declared variables: ShortcutDimCode1 - Code - 20 DefaultDim - Rec - "Default Dimension" DimensionValue - Rec - "Dimension Value"
Actually what need to do is while clicking the ShortcutDimCode1 in request form, it look-ups "Dimension Value" form.
DimensionValue.SETFILTER(DimensionValue."Dimension Code", 'GEOSECTOR'); IF FORM.RUNMODAL(FORM::"Dimension Values",DimensionValue) = ACTION::LookupOK THEN BEGIN ShortcutDimCode1 := DimensionValue.Code; END;
After selecting the Dimension Value in request form, the value should get filter with the "Dimension Value Code" field of "Default Dimension" table. Table ID field is always 18 (pointing Customer table).
Customer - OnPreDataItem() DefaultDim.RESET; DefaultDim.SETRANGE(DefaultDim."Dimension Value Code", ShortcutDimCode1); IF DefaultDim.FINDFIRST THEN BEGIN REPEAT CustNo := DefaultDim."No."; UNTIL DefaultDim.NEXT = 0; END;
Then it must display the corresponding Customers with the same Dimension Value Code.
I have mentioned the coding pieces that I did. I'm getting only 1 "Customer" of the "Dimension Value Code". But I need all the Customers to get displayed.
Can you please point out where I did mistake?
Thanks,
Aarvi.
0
Answers
-
Hi Guys !
I have solved this issue by the following code. instead of doing it in Customer - OnPreDataItem(), i made the following code and solved this issue.
Variables required..
blCheck - boolean
In Customer - OnAfterGetRecord()IF ShortcutDimCode1 <> '' THEN BEGIN CLEAR(blCheck); DefaultDim.RESET; DefaultDim.SETFILTER(DefaultDim."Dimension Value Code", ShortcutDimCode1); IF DefaultDim.FINDFIRST THEN BEGIN REPEAT IF Customer."No." = DefaultDim."No." THEN BEGIN blCheck := TRUE; ShortcutDimCodeValue := DefaultDim."Dimension Value Code"; DimensionValue2.SETFILTER(DimensionValue2."Dimension Code",'GEOSECTOR'); DimensionValue2.SETRANGE(DimensionValue2.Code,ShortcutDimCodeValue); IF DimensionValue2.FINDFIRST THEN ShortcutDimCodeValue1 := DimensionValue2.Name; END; UNTIL DefaultDim.NEXT = 0; codGeoSector := 'GEOSECTOR: ' + ShortcutDimCodeValue + ' - ' + ShortcutDimCodeValue1; END; IF blCheck = FALSE THEN CurrReport.SKIP; END;
Hope the above code helps, if you need to do this type of report.
Thanks,
Aravindh0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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