Thank you martin,
I am newbie and I not sure about the version ,thanks getting me corrected that I won't repeat the mistake again.
class DialogLookup_bharath extends RunBase
{
Dialog dialog;
FormStringControl control;
DialogField fieldLookup;
PurchTable Purchtable;
}
protected Object dialog()
{
dialog = super();
dialog.caption("My custom dialog box");
fieldLookup = dialog.addField(extendedTypeStr(PurchIdBase),"PurchId:");
control = fieldLookup.control();
control.registerOverrideMethod(methodStr(FormStringControl,lookup),methodstr(DialogLookup_bharath,lookup),this);
return dialog;
}
public void lookup(FormStringControl _control)
{
Query query = new Query();
QueryBuildDataSource querybuilddatasource;
SysTableLookup systablelookup = SysTableLookup::newParameters(tableNum(PurchTable), _control);
systablelookup.addLookupfield(fieldNum(PurchTable,PurchId));
querybuilddatasource = query.addDataSource(tableNum(PurchTable));
systablelookup.parmQuery(query);
systablelookup.performFormLookup();
}
public void run()
{
PurchIdBase getPurchId;
getPurchId = fieldLookup.value();
if(dialog.closedOk())
{
while select Purchtable
{
if(Purchtable.PurchId == getPurchId)
{
Global::info(strFmt('%1-%2-%3-%4-%5-%6-%7', PurchTable.PurchId,PurchTable.Orderaccount,PurchTable.PurchName,PurchTable.Invoiceaccount,PurchTable.Purchstatus,PurchTable.Documentstatus,PurchTable.DeliveryDate));
break;
}
}
}
}
static void main(Args _args)
{
DialogLookup_bharath dialoglookup =new DialogLookup_bharath();
if (dialoglookup.prompt())
{
dialoglookup.run();
}
}
This how I reduced the fields in the lookup form by using dialog box.
I have written the run method to display the PUrchID details whenever i select the purchid and click OK using the clickedOK method.
Regards,
Bharath K