I have a table which stores a history of import files from various sources via a dataport.
e.g.
Source Code, File No
AMO001 1
AMO001 2
NEW001 1
What is the best method to find the last succesful import file no for a given source code? (In the above example this would be 2 for AMO001). In SQL I would use:
SELECT MAX(file_no)
FROM IMPORT_HISTORY
WHERE SOURCE_CODE = 'AMO001';
I haven't yet found a way to do this in Navision. Sorry it's a basic question, but I am very new to this!
I am using a codeunit function to attempt to do this with the following code:
"Import History".INIT;
"Import History".SETFILTER("Import History"."Source Code", "Source Code");
CurrFileNo := "Import History".GETRANGEMAX("File No");
I thought that applying a filter to the table and then using GetRangeMax would do it. However, when I try GETRANGEMAX it says I must set a filter on that specific field (file No). Why? Surely we have already filtered the table using a different field (Source Code).
0
Comments