热门标签 | 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。


推荐阅读
  • MyBatis多表查询与动态SQL使用
    本文介绍了MyBatis多表查询与动态SQL的使用方法,包括一对一查询和一对多查询。同时还介绍了动态SQL的使用,包括if标签、trim标签、where标签、set标签和foreach标签的用法。文章还提供了相关的配置信息和示例代码。 ... [详细]
  • 本文讨论了如何使用IF函数从基于有限输入列表的有限输出列表中获取输出,并提出了是否有更快/更有效的执行代码的方法。作者希望了解是否有办法缩短代码,并从自我开发的角度来看是否有更好的方法。提供的代码可以按原样工作,但作者想知道是否有更好的方法来执行这样的任务。 ... [详细]
  • 本文介绍了在处理不规则数据时如何使用Python自动提取文本中的时间日期,包括使用dateutil.parser模块统一日期字符串格式和使用datefinder模块提取日期。同时,还介绍了一段使用正则表达式的代码,可以支持中文日期和一些特殊的时间识别,例如'2012年12月12日'、'3小时前'、'在2012/12/13哈哈'等。 ... [详细]
  • 模板引擎StringTemplate的使用方法和特点
    本文介绍了模板引擎StringTemplate的使用方法和特点,包括强制Model和View的分离、Lazy-Evaluation、Recursive enable等。同时,还介绍了StringTemplate语法中的属性和普通字符的使用方法,并提供了向模板填充属性的示例代码。 ... [详细]
  • Android自定义控件绘图篇之Paint函数大汇总
    本文介绍了Android自定义控件绘图篇中的Paint函数大汇总,包括重置画笔、设置颜色、设置透明度、设置样式、设置宽度、设置抗锯齿等功能。通过学习这些函数,可以更好地掌握Paint的用法。 ... [详细]
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • 本文介绍了OC学习笔记中的@property和@synthesize,包括属性的定义和合成的使用方法。通过示例代码详细讲解了@property和@synthesize的作用和用法。 ... [详细]
  • 本文介绍了在Linux下安装Perl的步骤,并提供了一个简单的Perl程序示例。同时,还展示了运行该程序的结果。 ... [详细]
  • 拥抱Android Design Support Library新变化(导航视图、悬浮ActionBar)
    转载请注明明桑AndroidAndroid5.0Loollipop作为Android最重要的版本之一,为我们带来了全新的界面风格和设计语言。看起来很受欢迎࿰ ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • Linux环境变量函数getenv、putenv、setenv和unsetenv详解
    本文详细解释了Linux中的环境变量函数getenv、putenv、setenv和unsetenv的用法和功能。通过使用这些函数,可以获取、设置和删除环境变量的值。同时给出了相应的函数原型、参数说明和返回值。通过示例代码演示了如何使用getenv函数获取环境变量的值,并打印出来。 ... [详细]
  • 超级简单加解密工具的方案和功能
    本文介绍了一个超级简单的加解密工具的方案和功能。该工具可以读取文件头,并根据特定长度进行加密,加密后将加密部分写入源文件。同时,该工具也支持解密操作。加密和解密过程是可逆的。本文还提到了一些相关的功能和使用方法,并给出了Python代码示例。 ... [详细]
  • 深入理解Java虚拟机的并发编程与性能优化
    本文主要介绍了Java内存模型与线程的相关概念,探讨了并发编程在服务端应用中的重要性。同时,介绍了Java语言和虚拟机提供的工具,帮助开发人员处理并发方面的问题,提高程序的并发能力和性能优化。文章指出,充分利用计算机处理器的能力和协调线程之间的并发操作是提高服务端程序性能的关键。 ... [详细]
  • 从批量eml文件中提取附件的Python代码实现方法
    本文介绍了使用Python代码从批量eml文件中提取附件的实现方法,包括获取eml附件信息、递归文件夹下所有文件、创建目的文件夹等步骤。通过该方法可以方便地提取eml文件中的附件,并保存到指定的文件夹中。 ... [详细]
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社区 版权所有