热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在AOT查询中规避有效时间状态-CircumventValidTimeStateinAOTqueries

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 个解决方案

#1


4  

I "solved" my own problem...

我“解决”了我自己的问题......

For some reason the report did not correctly inherit the properties (ExistsJoin) from the AOT query. After dropping the query on the report again, some compilations and the following code in the query init method, it works :) No more duplicate records!

由于某种原因,报告未正确地从AOT查询继承属性(ExistsJoin)。再次在报表上删除查询,查询init方法中的一些编译和以下代码,它工作:)没有更多的重复记录!

this.query().validTimeStateDateTimeRange(DateTimeUtil::minValue(), 
                                         DateTimeUtil::maxValue());

#2


0  

As I see it, you have conflicting options:

在我看来,你有相互矛盾的选择:

I would like to get all employees that has a record in this table, even if they doesn't have a current employment

我想让所有在此表中都有记录的员工,即使他们没有当前的工作

and:

和:

the users needs to be able to filter on DefaultDimension from HcmEmployment

用户需要能够从HcmEmployment过滤DefaultDimension

If the user filters on the employment, should the employee then be printet, if the employment is not selected?

如果用户过滤就业,那么如果未选择就业,员工是否应该打印?

What you probably would like:

你可能想要的:

  • If not filtering on HcmEmployment disable that data source (property Enabled).

    如果不对HcmEmployment进行过滤,则禁用该数据源(属性已启用)。

  • If filtering on HcmEmployment use an exists join.

    如果对HcmEmployment进行过滤,则使用存在连接。

In both cases find the maxof(ValidFrom), maxof(ValidTo) by an independent select.

在这两种情况下,通过独立选择找到maxof(ValidFrom),maxof(ValidTo)。

Have a look on this answer to see how to edit query properties by code.

查看此答案,了解如何按代码编辑查询属性。

Or make two reports, one with and without a query to HcmEmployment.

或者制作两份报告,一份有或没有查询HcmEmployment。


推荐阅读
  • 本文详细介绍了Java中org.neo4j.helpers.collection.Iterators.single()方法的功能、使用场景及代码示例,帮助开发者更好地理解和应用该方法。 ... [详细]
  • Explore how Matterverse is redefining the metaverse experience, creating immersive and meaningful virtual environments that foster genuine connections and economic opportunities. ... [详细]
  • 本文详细介绍如何使用Python进行配置文件的读写操作,涵盖常见的配置文件格式(如INI、JSON、TOML和YAML),并提供具体的代码示例。 ... [详细]
  • 本文详细介绍了 GWT 中 PopupPanel 类的 onKeyDownPreview 方法,提供了多个代码示例及应用场景,帮助开发者更好地理解和使用该方法。 ... [详细]
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • 技术分享:从动态网站提取站点密钥的解决方案
    本文探讨了如何从动态网站中提取站点密钥,特别是针对验证码(reCAPTCHA)的处理方法。通过结合Selenium和requests库,提供了详细的代码示例和优化建议。 ... [详细]
  • IneedtofocusTextCellsonebyoneviaabuttonclick.ItriedlistView.ScrollTo.我需要通过点击按钮逐个关注Tex ... [详细]
  • 本文深入探讨了 Java 中的 Serializable 接口,解释了其实现机制、用途及注意事项,帮助开发者更好地理解和使用序列化功能。 ... [详细]
  • Android 渐变圆环加载控件实现
    本文介绍了如何在 Android 中创建一个自定义的渐变圆环加载控件,该控件已在多个知名应用中使用。我们将详细探讨其工作原理和实现方法。 ... [详细]
  • 本文详细解析了Python中的os和sys模块,介绍了它们的功能、常用方法及其在实际编程中的应用。 ... [详细]
  • RecyclerView初步学习(一)
    RecyclerView初步学习(一)ReCyclerView提供了一种插件式的编程模式,除了提供ViewHolder缓存模式,还可以自定义动画,分割符,布局样式,相比于传统的ListVi ... [详细]
  • 本文详细介绍了macOS系统的核心组件,包括如何管理其安全特性——系统完整性保护(SIP),并探讨了不同版本的更新亮点。对于使用macOS系统的用户来说,了解这些信息有助于更好地管理和优化系统性能。 ... [详细]
  • 本文详细介绍了 Apache Jena 库中的 Txn.executeWrite 方法,通过多个实际代码示例展示了其在不同场景下的应用,帮助开发者更好地理解和使用该方法。 ... [详细]
  • 从 .NET 转 Java 的自学之路:IO 流基础篇
    本文详细介绍了 Java 中的 IO 流,包括字节流和字符流的基本概念及其操作方式。探讨了如何处理不同类型的文件数据,并结合编码机制确保字符数据的正确读写。同时,文中还涵盖了装饰设计模式的应用,以及多种常见的 IO 操作实例。 ... [详细]
  • 本文介绍如何通过创建替代插入触发器,使对视图的插入操作能够正确更新相关的基本表。涉及的表包括:飞机(Aircraft)、员工(Employee)和认证(Certification)。 ... [详细]
author-avatar
郭建将_683
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有