- Design a Form as Below
- Here I Added a Button Named as Print
void clicked()
{
Args args = new args();
ReportRun reportRun;
;
args.parm(Customers.valueStr()); //Customers indicates Lookup name
args.name(reportstr("Custtrans")); //Custtrans indicates Morphx report name
reportRun = classFactory.reportRunClass(args);
reportRun.init();
reportrun.run();
//reportRun.wait();
//args.parmObject( args );
super();
}
- Added a StringEdit control Named as Customers //Auto declaration Yes
public void lookup()
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(custTable), this);
sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));
sysTableLookup.performFormLookup();
//super();
}
- Design a Morphx Report
Under Report override Init Method
public void init()
{
Query query1 = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
str var;
;
var = element.args().parm();
try
{
if(element.args().parm())
{
query1.addDataSource(tablenum(CustTrans)).addRange(fieldnum(CustTrans, AccountNum)).value(queryValue(element.args().parm()));
this.query(query1);
this.query().userUpdate(false);
this.query().interactive(false);
super();
}
}
catch(exception::Error)
{
info("Error in init method");
}
}
No comments:
Post a Comment