Hello Friend am working on a report and i have a list of account numbers i want to setrange for to sort but am getting a run time error some assistance please
GLEntry.SETRANGE("G/L Account No.",'100000','199999'); REPEAT GLEntry.FIND('-'); UNTIL GLEntry.NEXT <= 0;
You code looks fine as such. Although I would write it like this instead:
GLEntry.SETRANGE("G/L Account No.",'100000','199999');
IF GLEntry.FINDSET THEN
CASE GLEntry."Global Dimension 1 Code" OF
'002' : GovmentGran := GLEntry.Amount;
'003' : LocalRevenue := GLEntry.Amount;
'100'..'199' : Donor := GLEntry.Amount;
'200'..'299' : Projects := GLEntry.Amount;
'300'..'399' : Others := GLEntry.Amount;
UNTIL GLEntry.NEXT = 0;
But then again, not really sure what the code is doing on the OnPreSection trigger? That section is primarily used to control if the section should be displayed or not. And again, putting it here, then you are resetting the filter for ever record.
If you already have GLEntry as one of your dataitems in the report, then you should put the filter into the properties of the dataitem, then NAV will find the right accounts. Then put the "CASE ... OF" statement (without FINDSET) into the OnAfterGetRecord trigger.