ZipCodeLookup: findrecord is soooo slow

Hi! Imagine your ZipCode table contains about 100.000 records. When you are in the CustTable form where the customer has a zipcode at the end of the table and you click on the lookup button, Axapta will open the form and then you’ll have to wait and wait and wait until Axapta found the record. The reason for this is that Axapta uses the “findrecord” command in the FRM ZipCodeLookup, method run. What makes me curious now is that a “normal” lookup will have the same result but much much faster. I emptied the “FormHelp” property for EDT ZipCodeID and the result is amazing: Axapta is placed on the correct record in milliseconds. Question now: how does the standard lookup form position itself on the correct record? Obviously it uses another algorithm but which one? Thanx!

Helmut, I’ve seen this one before - as far as I remember the problem is an index on the ZipCode table. I will have a look through my documents to see if I can find the solution again. Cheers, H. Jaeger

Hi Helmut, If you are using Axapta 3.0 ver 3.0, this is a known bug. Try to change run() method in ZipCodeLookup form like below -


---

public void run()
{

ZipCode    zipcodeCurrent;
;

element.lock();

super();

if (callerAddressMap)
{

if (!this.calledWithWildCard())
{
    zipcodeCurrent = ZipCode::findBestMatch(callerAddressMap);

if (zipcodeCurrent)
{
  zipcode_ds.object(fieldNum(ZipCode,Zipcode)).filter(zipCodeCurrent.zipcode);

if (zipcodeCurrent.Country == callerAddressMap.Country)
zipcode_ds.object(fieldNum(zipCode, country)).filter(zipCodeCurrent.Country);
}
}
}

element.unLock();

}

---

Hope this helps, Harish Mohanbabu

Hi Harish I already had the same idea (well I used addrange and not the “filter” method) and the result is quite ok, but of course the system now displays only the ZipCode provided. What still makes me curious is: why is the standard lookup command so fast, is placed on the correct record and still displays all other records???