简体   繁体   English

从表单数据源返回一条记录

[英]Return one record from a form data source

I have a form with an existing data source. 我有一个包含现有数据源的表单。 This data source has a one to many relationship to another table that is not an existing data source. 此数据源与不是现有数据源的另一个表具有一对多关系。 Even though this second table contains multiple records (one to many), the field in the table that I want is duplicated across all records. 即使第二个表包含多个记录(一对多),我想要的表中的字段也会在所有记录中重复。 Therefore I want to add this second table as a data source, but only return one record from it. 因此,我想将第二个表添加为数据源,但仅从中返回一条记录。

If I add the second table directly, than my form contains a line for each record instead of just one. 如果我直接添加第二个表,那么我的表单将为每条记录包含一行,而不只是一行。

This problem was solved by creating a view to use as the new datasource. 通过创建用作新数据源的视图解决了该问题。 This view defined a calculated column that was based on a method that contained a query string that used TOP 1. The details in much more detail are at Martin Dráb's blog: https://community.dynamics.com/ax/b/goshoom/archive/2015/06/29/join-first-line-in-ax-2012 . 该视图定义了一个基于基于包含使用TOP 1的查询字符串的方法的计算列。有关更多详细信息,请参见MartinDráb的博客: https ://community.dynamics.com/ax/b/goshoom/ 存档/ 2015/06/29 / join-first-line-in-ax-2012

Use the property LinkType=ExistJoin on the datasource for your second table. 在第二个表的数据源上使用属性LinkType = ExistJoin。

See the TransactionLog form for example. 例如,请参见TransactionLog表单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM