Override Context method of Form control which is using display method and provide code for filter. E.g I have done below for PhysicalInvent field of InventOnHandItem form.
void context()
{
int selectedMenu;
real test;
formrun fr;
Args ag;
Itemname strtext;
querybuilddataSource qb1;
queryrun qr;
query q;
PopupMenu menu = new PopupMenu(element.hWnd());
int a = menu.insertItem('Find');
int b = menu.insertItem('Filter');
int c = menu.insertItem('Remove Filter');
selectedMenu = menu.draw();
switch (selectedMenu)
{
case -1:
break;
case a:
ag = new args('SysformSearch');
fr = new formrun(ag);
fr.run();
fr.wait();
strtext = fr.design().controlName('FindEdit').valueStr();
if(strtext)
{
q = inventSum_Ds.query();
qb1 =q.dataSourceTable(tablenum(InventSum));
QB1.addRange(FieldNum(InventSum,PhysicalInvent)).value(SySQuery::value(strtext));
INVENTSUM_DS.query(Q);
INVENTSUM_ds.executeQuery();
}
break;
case b:
InventSum_DS.filter(FieldNum(InventSum,PhysicalInvent),Sysquery::value(InventSum.PhysicalInvent()));
break;
case c :
InventSum_DS.removeFilter();
break;
Default:
break;
}
}
This blog is for Dynamics AX (AXAPTA) Developers,this will help you for your development issues. This site contains some Microsoft Dynamics AX X++ Codes for use in your day to day use.
15 March 2011
Subscribe to:
Post Comments (Atom)
Ledger Voucher creation Framework and x++ code to create ledger voucher
Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...
-
{ "Message" : "Please verify that the user is valid and set up correctly." } Sol: System Administration > Se...
-
Please click here to access Custom Workflow step by step process:
-
FormRun formRun = sender.formRun(); Object inventTrans_ds = formRun.dataSource(formDataSourceStr(InventMarking,InventTransO...
Hi,
ReplyDeleteThanks for your posting.
I would like to ask a question. Because your solution did not work in my situation.
My Situation as below: I would like to add Customer Name into CustTransOpen. And I want this display method can be find/filter as a normal field.
In my case field Name is not a real field in CustTransOpen Table.
So, In the context() method of this display field I could not add the range as your code.
Do you have solution for this situation?
Thank you & Best Regards.