Lookup

HI Friends,

i have to show values in lookup of a control , where if i pass value A then look up will give all the child and grandchilds of A,

say it will show A,A1,A11,A12,B1,B2,B21…etc.

some thing like hirarchy.

pls help.

thanks manish

Hi,

Here’s an example I developped, it populates a zipcode field with the zipcodes from a specific country in another field:

first creating a method on the form:

void lookupPaysCP(formControl _ctrl,str _filterStr)

{
SysTableLookup sysTableLookup;
Query Query;
QueryBuildDataSource queryBuildDataSource;
QueryBuildDataSource queryBuildDataSource OBRDistance ;
;

_filterStr = this.OBRPays;

sysTableLookup = SysTableLookup::newParameters(tablenum( OBRDistance ), _ctrl);

sysTableLookup.addLookupfield(fieldnum( OBRDistance ,OBRZipcode));
sysTableLookup.addLookupfield(fieldnum( OBRDistance ,City));

query = new Query();

queryBuildDataSource = query.addDataSource(tableNum( OBRDistance ));
QueryBuildDataSource.addRange(fieldnum( OBRDistance ,OBRCountryRegionId)).value(this.OBRPays);

sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}

second, adding a lookup method on the field combo you want to be filtered depending on another

public void lookup(FormControl _formControl, str _filterStr)
{
;
_filterStr = Distances_OBRPays.text();
PurchLine.lookupPaysCP(_formControl, _filterStr);
}

You have just to adapt this code to your case, email me if you want further informations

regards,

Thomas