AX2009 EP 带有连接表的自定义查找

发布于 2024-10-11 14:38:55 字数 1517 浏览 3 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谈下烟灰 2024-10-18 14:38:55

以下博客文章对此进行了讨论:
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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文