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.
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.
Answers
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()
Hope the above code helps, if you need to do this type of report.
Thanks,
Aravindh