作者:郭建将_683 | 来源:互联网 | 2023-10-13 11:12
IhaveanAOTqueryinDynamicsAX2012whichconsistsoftheHcmWorkerandHcmEmploymenttables(am
I have an AOT query in Dynamics AX 2012 which consists of the HcmWorker and HcmEmployment tables (among others). My problem is that when I create a report (not SSRS), or otherwise use this query, I only get the employees with a valid time state in HcmEmployment.
我在Dynamics AX 2012中有一个AOT查询,它包含HcmWorker和HcmEmployment表(以及其他表)。我的问题是,当我创建报告(而非SSRS)或以其他方式使用此查询时,我只会让员工在HcmEmployment中拥有有效的时间状态。
I would like to get all employees that has a record in this table, even if they doesn't have a current employment - and only once. The optimal solution is to get the record from HcmEmployment for the current employment, if it exists, and otherwise the last record with a start date before "now". However, I can accept a solution where it joins with the last start date.
我想让所有在此表中都有记录的员工,即使他们没有当前的工作 - 只有一次。最佳解决方案是从当前就业的HcmEmployment(如果存在)中获取记录,否则在“现在”之前的最后记录具有开始日期。但是,我可以接受一个与上一个开始日期相连的解决方案。
I would prefer a solution where I do not need to add code every time I use it (i.e. solve it in the AOT query).
我更喜欢一个解决方案,每次我使用它时都不需要添加代码(即在AOT查询中解决它)。
I have tried setting the validTimeStateDateTimeRange property on the query from code, which resulted in duplicate lines if the employee has several employments.
我已经尝试从代码中设置查询的validTimeStateDateTimeRange属性,如果员工有多个就业,则会导致重复的行。
If I set the HcmEmployment datasource to ExistsJoin and firstOnly, then it works in a view, but not on reports (still duplicate records) :( Using this view on reports is not an option, because the users needs to be able to filter on DefaultDimension from HcmEmployment.
如果我将HcmEmployment数据源设置为ExistsJoin和firstOnly,那么它在视图中工作,但不在报表上(仍然是重复记录):(在报表上使用此视图不是一个选项,因为用户需要能够对DefaultDimension进行过滤来自HcmEmployment。
How can I solve this problem?
我怎么解决这个问题?
2 个解决方案