form controls lookup...

hi,

i need to fetch the categorys in a lookup basing on the categorygroup in a form. this to fields in the table SMAAgreement table and i added projCatogoryId and projCategoryGroupId EDT 's for those fields respectively.

can u please suggest me to acheive this?

i wrote the code as follows in the formControl projCategoryId in the design part of the form.

public void lookup()
{
Query query= new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup;
;

sysTableLookup = SysTableLookup::newParameters(tablenum(SMAAgreementLine),this);

queryBuildDataSource = query.addDataSource(tablenum(SMAAgreementLine));
sysTableLookup.addLookupfield(fieldnum(SMAAgreementLine, projCategoryId),true);

queryBuildRange = queryBuildDataSource.addRange(fieldnum(SMAAgreementLine, projCategoryGroupId));
queryBuildRange.value(SMAAgreementLine.ProjCategoryGroupId);

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

//super();
}

but it is showing empty grid in the lookup…