[英]Add custom datasouce to form in ax 2012
我想將與數據源的自定義關系添加到AX 2012中的表單中。
當我使用該選項將數據源添加為“引用的數據源”時,系統會使用AutoReport字段將自動連接到表中的字段組中,但是我想使用另一個字段來獲取信息進行連接
例。
我有CustTrans表,我想要訂單帳戶名,但是當我放置參考數據源時,僅顯示帳戶名而不是訂單帳戶名。
我不知道帶有querybuilddatasource的選項是否有效。
謝謝你的時間
您可以在CustTrans
表上創建顯示方法,而不是加入新的數據源,例如:
//BP Deviation Documented
display CustName orderAccountName()
{
CustTable custTable;
DirPartyTable partyTable;
select firstonly Party from custTable
where custTable.AccountNum == this.OrderAccount
join Name from partyTable
where partyTable.RecId == custTable.Party;
return partyTable.Name;
}
然后,您可以僅使用此顯示方法在表單上顯示要訂購的帳戶名稱。
如果確實要添加新數據源並使用OrderAccount
字段進行鏈接,則可以照常添加CustTable
數據源(JoinSource = CustTrans,LinkType = InnerJoin或OuterJoin等),並覆蓋其init
方法,例如:
void init()
{
QueryBuildDataSource qbds;
super();
qbds = this.queryBuildDataSource();
qbds.clearLinks();
qbds.addLink(fieldNum(CustTrans, OrderAccount), fieldNum(CustTable, AccountNum));
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.