AX2009 EP 带有连接表的自定义查找
我正在尝试使用 2 个连接表进行自定义查找(在 .Net 中):
AxLookup nameLookup = e.LookupControl;
Proxy.QueryBuildDataSource emplTable = null;
Proxy.QueryBuildDataSource dirPartyTable = null;
using (Proxy.SysDataSetBuilder sysDataSetBuilder = proxy.SysDataSetBuilder.constructLookupDataSet(this.AxSession.AxaptaAdapter, TableMetadata.TableNum(this.AxSession, "EmplTable")))
{
nameLookup.LookupDataSet = new DataSet(this.AxSession, sysDataSetBuilder.toDataSet());
}
using (Proxy.Query query = nameLookup.LookupDataSet.DataSetViews[0].MasterDataSource.query())
{
emplTable = query.dataSourceNo(1);
dirPartyTable = emplTable.addDataSource(TableMetadata.TableNum(this.AxSession, "DirPartyTable"));
dirPartyTable.clearLinks();
dirPartyTable.addLink(TableDataFieldMetadata.FieldNum(this.AxSession, "EmplTable", "PartyId"), TableDataFieldMetadata.FieldNum(this.AxSession, "DirPartyTable", "PartyId"));
dirPartyTable.joinMode = 6; //should be an exists join
}
nameLookup.LookupDataSet.Init();
nameLookup.Fields.Add(AxBoundFieldFactory.Create(this.AxSession, nameLookup.LookupDataSetViewMetadata.ViewFields["EmplId"]));
nameLookup.Fields.Add(AxBoundFieldFactory.Create(this.AxSession, nameLookup.LookupDataSetViewMetadata.ViewFields["DirPartyTable!Name"])); //not working!!
nameLookup.SelectField = "EmplId";
现在,当我使用查找时,它会出现有关 DirPartyTable 中的名称字段的错误(未找到密钥)有人知道如何在 a 中添加查找字段吗?加入表?
我确信连接工作正常,在连接表上进行了一些其他范围的查找(当然第二个表上没有查找字段)并且工作正常。
任何帮助表示赞赏!
I'm trying to make custom lookup (in .Net) using 2 joined tables:
AxLookup nameLookup = e.LookupControl;
Proxy.QueryBuildDataSource emplTable = null;
Proxy.QueryBuildDataSource dirPartyTable = null;
using (Proxy.SysDataSetBuilder sysDataSetBuilder = proxy.SysDataSetBuilder.constructLookupDataSet(this.AxSession.AxaptaAdapter, TableMetadata.TableNum(this.AxSession, "EmplTable")))
{
nameLookup.LookupDataSet = new DataSet(this.AxSession, sysDataSetBuilder.toDataSet());
}
using (Proxy.Query query = nameLookup.LookupDataSet.DataSetViews[0].MasterDataSource.query())
{
emplTable = query.dataSourceNo(1);
dirPartyTable = emplTable.addDataSource(TableMetadata.TableNum(this.AxSession, "DirPartyTable"));
dirPartyTable.clearLinks();
dirPartyTable.addLink(TableDataFieldMetadata.FieldNum(this.AxSession, "EmplTable", "PartyId"), TableDataFieldMetadata.FieldNum(this.AxSession, "DirPartyTable", "PartyId"));
dirPartyTable.joinMode = 6; //should be an exists join
}
nameLookup.LookupDataSet.Init();
nameLookup.Fields.Add(AxBoundFieldFactory.Create(this.AxSession, nameLookup.LookupDataSetViewMetadata.ViewFields["EmplId"]));
nameLookup.Fields.Add(AxBoundFieldFactory.Create(this.AxSession, nameLookup.LookupDataSetViewMetadata.ViewFields["DirPartyTable!Name"])); //not working!!
nameLookup.SelectField = "EmplId";
Now when I use the lookup it gives me an errror about the Name field in DirPartyTable (key not found) Does someone know how to add a lookupfield in a joined table?
I'm sure the join works ok, made some other lookups with ranges on the joined table (and ofcourse no lookupfields on the second table) and that works ok.
Any help is appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下博客文章对此进行了讨论:
http://palleagermark.blogspot.com/2009 /12/data-set-lookups-on-enterprise-portal.html
答案是,您不能将数据源与 AxLookup 控件一起使用,因为它是为仅支持一个 DataSetView 而构建的,并且会抛出此异常如果您有多个。
This has been discussed in the following blog post:
http://palleagermark.blogspot.com/2009/12/data-set-lookups-on-enterprise-portal.html
The answer is that you cannot use a datasource with a join with the AxLookup control as it was built to support only one DataSetView and will throw this exception if you have more than one.