foundset.loadRecords(dataSet) expects a data set of just the pk columns.
If you have more columns in the dataset the remaining are ignored, but the first columns have to match the pk columns in alphabetical order.
I solved the problem. The loadRecords method expects the first column to be the primary key of the table. The codes above will work just fine. But if I change line 002 with the one below, it will yield 0 records:
002 var dataList = databaseManager.getDataSetByQuery(DB_SERVER_NAME, “SELECT AGG_FNCTN ADDTL_COLUMN ,* FROM TABLE_NAME”, null, -1);