Get Customer, Vendor& Company Addresses in AX 2012

 Get Customer,  Vendor& Company Addresses in AX 2012

//Get Customer/Vendor Address by Id & Current Comapny Address
//By replacing the CustTable with the VendTable we will get the address of Vendor
static void Job85(Args _args)
{
    CustTable custTable;
    str       description,address,completeaddress;
    
    custTable = CustTable::find('L0115');
          
    description = DirParty::primaryPostalAddress(custTable.Party).displayLocationDescription();
    
    address = DirParty::primaryPostalAddress(custTable.Party).Address;
    
    completeaddress = strFmt("%1,%2",description,address);
    info(strFmt("%1",completeaddress));
    
    //Get the Current Company Address
    info(strFmt("%1,%2",curext(),LogisticsPostalAddress::findByLocation(CompanyInfo::find().postalAddress().Location).Address));
    
}

Adding Find\Filter functionality on Display method

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()
{

//TODO::Filtered Data is not accurate need to work

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.physicalInventUnit()));
break;

case c :
InventSum_DS.removeFilter();
break;

Default:
break;
}
}