Dear Experts,
I want to set filter on the report's dataitem using a text variable. I understand that this can be done using ReqFilterFields but the system design is as such that the records we want to select do not exist in the standard LookupPageID.
DataItem is Fixed Asset.
LookupPageID on Fixed Asset table is Fixed Asset List.
I have a field "Equipment Asset" in fixed asset table and SourceTableView in Fixed Asset List is 'WHERE(Equipment Asset=CONST(No))'.
There is another list page named Equipment FA and SourceTableView in this list page is 'WHERE(Equipment Asset=CONST(Yes))'.
Now, in my report I have a variable FANoFilter added in Request page. In the OnLookup Trigger of this variable, I have written the code as shown below,
CLEAR(EquipmentFAList);
FixedAsset.RESET;
FixedAsset.SETRANGE("Equipment Asset",TRUE);
EquipmentFAList.LOOKUPMODE(TRUE);
EquipmentFAList.SETTABLEVIEW(FixedAsset);
IF EquipmentFAList.RUNMODAL = ACTION::LookupOK THEN BEGIN
EquipmentFAList.GETRECORD(FixedAsset);
FANoFilter := FixedAsset."No.";
END;
The code shown below is on Fixed Asset - OnPreDataItem() in the report,
IF FANoFilter <> '' THEN
"Fixed Asset".SETFILTER("Fixed Asset"."No.",'%1',FANoFilter);
If I select FA0001 in FANoFilter and execute the report, the report works fine!
If I apply filter like FA0001..FA0010 or FA0001|FA0002 in this text variable (FANoFilter), the report is not considering this as a range or two FA nos., but it is taking these filters as one FA no. and the report doesn't execute.
Please guide how may I achieve the desired solution? Thanks in advance!