Reason: in the form ZipCodeLookup, method "run", the standard system uses the function "findrecord". Findrecord will go through the table and compare each record with the one you search! This is the same as if you would go down the form clicking each record.
The sad thing is: there's not much you can do about it. The only thing I thound was to replace the findrecord method with a filter.
Advantage: the lookup will show up immediately.
Disadvantage: the lookup form will only show records that match the zipcode from the previous form. Here's what you have to change in the method:
if (zipCodeCurrent)
{
//zipCode_ds.findRecord(zipCodeCurrent); // Ori
// Replace original line above with next line
zipCode_ds.query().dataSourceTable(tableNum(ZipCode)).addRange(fieldNum(ZipCode, ZipCode)).value(zipcodecurrent.ZipCode+".."); zipCode_ds.executeQuery();
}
if (zipCodeCurrent)
{
//zipCode_ds.findRecord(zipCodeCurrent); // Ori
// Replace original line above with next line
zipCode_ds.query().dataSourceTable(tableNum(ZipCode)).addRange(fieldNum(ZipCode, ZipCode)).value(zipcodecurrent.ZipCode+".."); zipCode_ds.executeQuery();
}
Give it a try! And tell me what you think about it!
What will the script do?




At the lower part of the screenshot, you can see the call stack (if not, go to menu "View" and activate menu item "Call stack").
You can see that the debugger put us exactly to the place where the error was thrown.
In the system monitoring window, also a Pseudo-simulation of a certain bandwidth and/or latency can be tested.
