public boolean fetch()
{
QueryRun qr;
QueryBuildRange rangeTransDate;
Boolean ret;
qr = new QueryRun(element);
rangeTransDate =
element.query().dataSourceTable(tablenum(CustTrans)).addRange(fieldnum(CustTrans, transDate));
rangeTransDate.value(queryRange(systemdateGet()-daysBack, systemDateGet()));
rangeTransDate.status(RangeStatus::LOCKED);
element.design().caption(strfmt("%1, %2", element.design().caption(), rangeTransDate.value()));
if (qr.prompt() && element.prompt())
{
while (qr.next())
{
custTable = qr.get(tableNum(CustTable));
custTrans = qr.get(tableNum(CustTrans));
if (!custTable)
{
ret = false;
break;
}
if (qr.changed(tableNum(custTable)))
{
element.send(custTable, 1);
}
if (qr.changed(tableNum(custTrans)))
{
element.send(custTrans, 2);
}
}
ret = true;
}
else
ret = false;
return ret;
}
Below Code to get customer Primary Address in Ax 2012. CustTable custTable_P; DirPartyTable dirPartyTable_P; DirPartyLocation dirPartyLocation_P; DirPartyLocationRole dirPartyLocationRole_P; LogisticsLocation logisticsLocation_P; LogisticsLocationRole logisticsLocationRole_P; LogisticsPostalAddress logisticsPostalAddress_P; LogisticsPostalAddress primaryAddress_P; while select custTable_P where custTable_P.AccountNum =='ED_01029' join dirPartyTable_P where dirPartyTable_P.RecId == custTable_P.Party join dirPartyLocation_P where dirPartyLocation_P.Party == custTable_P.Party && dirPartyLocation_P.IsPrimary==NoYes::Yes join dirPartyLocationRole_P where dirPartyLocationRole_P.PartyLocation == dirPartyLocation_P.RecId join logisticsLocationRole_P where logisticsLocationRole_P.RecId == dirPartyLocationRole...