Other recent Dynamics AX Blog postings

Donnerstag, Dezember 08, 2005

Slow ZipCodeLookup

If you have lots of zipcodes in your Zipcode table, you will get the problem that when you click on the lookup button of your zipcode field and it happens that the content of the zipcode field is one of the last records in your table, you will have to wait and wait and wait...

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();
}


Give it a try! And tell me what you think about it!

Keine Kommentare: