How to Use Query in form runtime in Microsoft dynamics axapta


How to Use Query in form at runtime in microsoft dynamics axapta

Write following code in init method of form. you must create MyQr first which is name of query.

 QR QR;  
  Args args = new Args();  
  ;  
  super();  
  args.name(querystr(MyQR));  
  QR = classfactory.QRClass(args);  
  this.query(QR.query());