热门标签 | 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()方法的功能、使用场景及代码示例,帮助开发者更好地理解和应用该方法。 ... [详细]
  • 深入理解 SQL 视图、存储过程与事务
    本文详细介绍了SQL中的视图、存储过程和事务的概念及应用。视图为用户提供了一种灵活的数据查询方式,存储过程则封装了复杂的SQL逻辑,而事务确保了数据库操作的完整性和一致性。 ... [详细]
  • 本文详细介绍了Akka中的BackoffSupervisor机制,探讨其在处理持久化失败和Actor重启时的应用。通过具体示例,展示了如何配置和使用BackoffSupervisor以实现更细粒度的异常处理。 ... [详细]
  • 解读MySQL查询执行计划的详细指南
    本文旨在帮助开发者和数据库管理员深入了解如何解读MySQL查询执行计划。通过详细的解析,您将掌握优化查询性能的关键技巧,了解各种访问类型和额外信息的含义。 ... [详细]
  • 从 .NET 转 Java 的自学之路:IO 流基础篇
    本文详细介绍了 Java 中的 IO 流,包括字节流和字符流的基本概念及其操作方式。探讨了如何处理不同类型的文件数据,并结合编码机制确保字符数据的正确读写。同时,文中还涵盖了装饰设计模式的应用,以及多种常见的 IO 操作实例。 ... [详细]
  • Explore how Matterverse is redefining the metaverse experience, creating immersive and meaningful virtual environments that foster genuine connections and economic opportunities. ... [详细]
  • 本文介绍如何使用Objective-C结合dispatch库进行并发编程,以提高素数计数任务的效率。通过对比纯C代码与引入并发机制后的代码,展示dispatch库的强大功能。 ... [详细]
  • 本文详细介绍如何使用Python进行配置文件的读写操作,涵盖常见的配置文件格式(如INI、JSON、TOML和YAML),并提供具体的代码示例。 ... [详细]
  • 技术分享:从动态网站提取站点密钥的解决方案
    本文探讨了如何从动态网站中提取站点密钥,特别是针对验证码(reCAPTCHA)的处理方法。通过结合Selenium和requests库,提供了详细的代码示例和优化建议。 ... [详细]
  • 导航栏样式练习:项目实例解析
    本文详细介绍了如何创建一个具有动态效果的导航栏,包括HTML、CSS和JavaScript代码的实现,并附有详细的说明和效果图。 ... [详细]
  • 1.如何在运行状态查看源代码?查看函数的源代码,我们通常会使用IDE来完成。比如在PyCharm中,你可以Ctrl+鼠标点击进入函数的源代码。那如果没有IDE呢?当我们想使用一个函 ... [详细]
  • 数据库内核开发入门 | 搭建研发环境的初步指南
    本课程将带你从零开始,逐步掌握数据库内核开发的基础知识和实践技能,重点介绍如何搭建OceanBase的开发环境。 ... [详细]
  • Android 渐变圆环加载控件实现
    本文介绍了如何在 Android 中创建一个自定义的渐变圆环加载控件,该控件已在多个知名应用中使用。我们将详细探讨其工作原理和实现方法。 ... [详细]
  • 在使用 DataGridView 时,如果在当前单元格中输入内容但光标未移开,点击保存按钮后,输入的内容可能无法保存。只有当光标离开单元格后,才能成功保存数据。本文将探讨如何通过调用 DataGridView 的内置方法解决此问题。 ... [详细]
  • 本文介绍如何使用 NSTimer 实现倒计时功能,详细讲解了初始化方法、参数配置以及具体实现步骤。通过示例代码展示如何创建和管理定时器,确保在指定时间间隔内执行特定任务。 ... [详细]
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社区 版权所有