How to understand ReferenceGroup control on Form[AX2012]
在AX2012的Form开发中,微软引入了新的控件ReferenceGroup,它用在Lookup其他表RecId的时候显示更人性化的字段,它的使用还必须从表的索引说起。AX2012的表有这些索引(http://msdn.microsoft.com/en-us/library/hh812105.aspx):
Primary key:主键用来唯一标识一条纪录,比如InventTable的ItemIdx索引,包含ItemId字段,用它标识唯一的一个物料,AX2012要求主键必须只有一个字段,当然必须是唯一的。
Alternate Key:可以包含多个字段且索引必须是唯一的,其属性AllowDuplicated=No,AlternateKey=yes,可以把Alternate key设为表的主键,前提是只包含一个字段。对于ValidateTimeState的表可以在Alternate key上设置ValidateTimeStateKey属性。
Surrogate Key:就其说明来讲是指机器产生的唯一键,一般就是纪录的RecId,表的CreatedRecIdIndex=Yes创建Surrogate key,Surrogate key可以设置为表的主键。
Relacement Key:表的Replacement key属性下可以选择表的某个Alternate key,在设置Replacement key时,表的AutoIdentification filed group下自动包含Replacement key的字段,其意义是人能看懂的键,和Surrogate key对应。
ReferenceGroup控件就是依靠Surrogate key、Replacement Key和Autoidentification字段组来工作的,比如我们有个表叫做ProdCharge,包含ProdId、ChargeId和Qty三个字段,用来表示某个工单下的某车重量,ProdId和ChargeId表示工单下的某个车次,组合成一个Alternate Key,同时设置为表的Replacement key:

我们要在另外一张发货表DispatchPick中引用ProdCharge,可以在DispatchPick新建ProdId、ChargeId字段来表示要出货的某个车次,但是更方便的是直接使用ProdCharge的RecId:

新建一个DispatchPick form来编辑出货表DispatchPick,以前的方法在Lookup prodCharge表的时候你可能看到ProdCharge表的Recid一栏的内容,但是在AX2012中当我们把DispatchPick的ChargeRecId字段拖到Form上的时候会自动生成一个ReferenceGroup的控件:

注意它的Referencefield是DispatchPick的ChargeRecId字段,而RelacementFieldGroup自动设置为AutoIdentification,这里是可以选择其他字段组的比如AutoLookup字段组,我们这里就选择为ProdCharge表的AutoLookup字段组,运行一下DispatchPick form来看看:

可以看到Reference控件下包含了来自于ProdCharge的3个字段,分别是工单、车次号和数量,下拉Lookup的时候也出现ProdCharge的AutoLookup字段组的内容,而实际上保存在DispatchPick表中的ProdCharge数据仅仅是其RecId,这就是ReferenceGroup的作用,使用对我们没有意义的代码来关联表,在Lookup的时候则呈现更加人性化的字段,在以前的版本中这需要代码重载控件的Lookup方法来自定义Lookup form来实现,还必须加入一些display方法来显示来自于父表的prodid、chargeid这些信息,而使用referencegroup这些就变得很自然而不需要一行代码。当然AX2012也支持重载Lookup方法(http://msdn.microsoft.com/EN-US/library/hh185372),RefereceGroup控件还多了一个LookupReference方法(http://msdn.microsoft.com/EN-US/library/aa627966)。
另外在form的Datasource节点下多了一个Reference data source节点,用它来显式的定义一个引用数据源,这一般只在需要自定义引用数据源的AllowDeferredLoad、OnlyFetchActive属性的时候需要(http://msdn.microsoft.com/EN-US/library/gg845085)。
From: http://www.cnblogs.com/duanshuiliu/archive/2012/09/04/2669984.html
How to understand ReferenceGroup control on Form[AX2012]的更多相关文章
- Tutorial: WPF User Control for AX2012
原作者: https://community.dynamics.com/ax/b/goshoom/archive/2011/10/06/tutorial-wpf-user-control-for-ax ...
- Business Unit Lookup in Form
Just add the below code in lookup() of StringEdit control in Form to get the Business Unit Lookup: p ...
- 细说angular Form addControl方法
在本篇博文中,我们将接触angular的验证.angular的验证是由form 指令和ngModel协调完成的.今天博主在这里想要说的是在验证在的一种特殊情况,当验证控件没有没有name属性这是不会被 ...
- Using Controls in a Form Design [AX 2012]
Using Controls in a Form Design [AX 2012] This topic has not yet been rated - Rate this topic Update ...
- C#:将子Form加入父Form中
实现的功能:已建立了多个子Form界面,在父Form界面左面,点击不同标题的链接文本,父Form界面右面显示不同的子界面内容. 具体如下: 1.加入split拆分器控件 2.在splitControl ...
- angular2 学习笔记 ( Form 表单 )
refer : https://angular.cn/docs/ts/latest/guide/forms.html https://angular.cn/docs/ts/latest/cookboo ...
- Building Forms with PowerShell – Part 1 (The Form)
For those of you familiar with Scripting languages you are probably used to using alternate applicat ...
- [精]Oracle APEX 5.0 入门教程(一) Form表单
Oracle APEX Tutorial for Beginners (APEX 5.0) 1- Introduction 2- Create Workspace 3- Work with Works ...
- Sending form data
https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Sending_and_retrieving_form_data This arti ...
随机推荐
- TFS 2010 使用手册(一)安装与配置
本文转自cnblogs 大辉狼 的文章: http://www.cnblogs.com/wph1129/archive/2010/11/10/1873348.html http://www.cnblo ...
- as3.0 [Embed]标签嵌入外部资源
1.[Embed]嵌入资源 ActionScript代码的顺序非常重要.你必须在声明变量前添加[Embed]元数据标签,而且这个变量的类型会是Class; package { import flash ...
- 监控服务器JVM内存运行
使用jdk的jconsole进行监控jmx 首先,设置监控对象的端口 配置 catalina.sh #vi /usr/tomcat/bin/catalina.sh 注: /usr/tomcat/b ...
- linux服务监控脚本
配置需要监控的服务器 数组定义:host_ports=(host_name=host_port=uri_path)host_name为容易识别的服务器名称host_port为服务器ip和服务端口uri ...
- javascript跨域请求RESTful Web Service
跨域请求RESTful Web Service 当我们用js请求RESTful Web Service的时候,通常会出现跨域无法访问的问题,也就是无法正常得到我们要的值.jsonp是个解决问题的方法. ...
- hdu 4144 状态压缩dp
#include<map> #include<set> #include<cmath> #include<queue> #include<cstd ...
- 转: ios app架构设计
http://keeganlee.me/post/architecture/20160107 看完这一系列文章后就知道怎么回答这类问题了: App架构设计经验谈:接口的设计 App架构设计经验谈:技术 ...
- 两种局部刷新UITableView的方法的使用条件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ //1.取消选 ...
- C++之算法题模板
main.cpp: #include <iostream>#include <vector>#include <cstring>#include <cstdi ...
- html&css静态页面
状态不好,整晚未眠. 想着敲点代码,遇着复杂的又自己生气,所以就敲了博客园的,总是很纠结"哪样的文字算标题算段落或要用span""什么时候用div比较好"&qu ...