filtering a form w

Hi

In the form there are 2 data sources Invent table and offer item . in the form i create a enum called period the elements are week, next week, next month. when i selected week the form should filter records of this week . viceversa next week

next month based on start date and end date in offeritem

Hi Venkat,

Use lookup method for that enum field… so that based on the enum value selected u can filter

the records using from date and to date…

Lookup method in form datasouce field:

Ex:

public void lookup(FormControl _formControl, str _filterStr)

{

Query query = new Query();

QueryBuildDataSource queryDataSourceCode;

QueryBuildRange queryBuildRange;

SysTableLookup sysTableLookup;

TaxWithholdGroupData TaxWithholdGroupData;

str st;

;

if(LedgerJournalTrans.TaxWithholdGroup)

{

while select TaxWithholdGroupData where TaxWithholdGroupData.TaxWithholdGroup==LedgerJournalTrans.TaxWithholdGroup

{

if(st)

st=st+’,’+TaxWithholdGroupData.TaxWithholdCode;

else

st=TaxWithholdGroupData.TaxWithholdCode;

}

sysTableLookup=SysTableLookup::newParameters(tableNum(TaxWithholdTable),_formControl);

sysTableLookup.addLookupField(fieldNum(TaxWithholdTable, TaxWithholdCode));

sysTableLookup.addLookupField(fieldNum(TaxWithholdTable, TaxWithholdName));

queryDataSourceCode = query.addDataSource(tableNum(TaxWithholdTable));

queryBuildRange = queryDataSourceCode.addRange(fieldNum(TaxWithholdTable, TaxWithholdCode));

queryBuildRange.value(st);

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

}

}

lookup method in form design field:

Ex:

public void lookup()

{

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

Query query = new Query();

QueryBuildDataSource queryBuildDataSource;

;

sysTableLookup.addLookupfield(fieldnum(TaxWithholdTable, TaxWithholdCode));

sysTableLookup.addLookupfield(fieldnum(TaxWithholdTable, TaxWithholdName));

queryBuildDataSource = query.addDataSource(tablenum(TaxWithholdTable));

queryBuildDataSource.addRange(fieldnum(TaxWithholdTable,TaxWithholdCode)).value(strfmt(’!=%1’,TaxWithholdTable.TaxWithholdCode));

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

}