Axaptapedia is now maintained by AgileCadence For more information please click here.

Talk:Lookup Form

From Axaptapedia
Jump to: navigation, search

Search[edit]

I don't use <xpp> xyz_ds.findValue() </xpp> And I don't make modyfication on method run().

I simply change init method;

<xpp> public void init() {

   FormStringControl   callerControl   = SysTableLookup::getCallerStringControl(element.args());
   element.args().lookupValue(callerControl.text());  // this will work like standard Axapta lookup form :)
   element.args().lookupField(fieldnum(xyz,id));
   super();
   
   element.selectMode(xyz_id);

} </xpp>

Search by wild card also work with this.


The above does indeed work like a charm but has a minor flaw: If depends on the sort order of the query. If the query is not sorted by the field you are looking up (fieldnum(xyz, id) in the example) the lookup will not position the cursor correctly. You should fix your sort order to that field only.

Even then it is recommended to use this pattern. The findValue - Consort will only work on small tables as the client will cycle all records until it finds one appropriate. This works with 50 records but fails monumentally with 20.000 or even more, where it takes minuts, even hours to position the cursor correctly.