是否可以进行从多个表中获取数据的查找?

时间:2012-11-05 09:21:16

标签: axapta dynamics-ax-2009

在Dynamics Ax中,我可以使用sysTableLookup显示包含多列的网格的组合查找?

如何从多个表中获取数据?

2 个答案:

答案 0 :(得分:0)

您可以加入查询中的其他表格,请参阅以下Axaptapedia

中的示例
public void lookup()
{
  Query                   query = new Query();
  QueryBuildDataSource    dsCustTable;
  QueryBuildDataSource    dsCustTrans;

  // Instantiate sysTableLookup object using table which will provide the visible fields 
  SysTableLookup  sysTableLookup = sysTableLookup::newParameters(tableNum(CustTable), this);
  ;

  // Create the query.  Only select customers where blocked != All and one more more transactions
  // exist with no closed date
  dsCustTable = query.addDataSource(tableNum(CustTable));
  dsCustTable.addRange(fieldNum(CustTable, Blocked)).value(queryNotValue(CustVendorBlocked::All));

  dsCustTrans = dsCustTable.addDataSource(tableNum(CustTrans));
  dsCustTrans.relations(true);
  dsCustTrans.joinMode(JoinMode::ExistsJoin);
  dsCustTrans.addRange(fieldNum(CustTrans, Closed)).value(queryValue(dateNull()));

  // Set the query to be used by the lookup form
  sysTableLookup.parmQuery(query);

  // Specify the fields to show in the form.  In this case we have chosen
  // Account number, name, and dimension one.
  sysTableLookup.addLookupfield(fieldNum(CustTable, AccountNum));
  sysTableLookup.addLookupfield(fieldId2Ext(fieldNum(CustTable, Dimension), 1));

  // Perform the lookup
  sysTableLookup.performFormLookup();
}

答案 1 :(得分:0)

您可以在查找中使用显示方法从其他表中提取数据。

或者您可以使用此扩展程序: http://kashperuk.blogspot.co.uk/2008/09/sysmultitableloookup-dynamic-lookups.html