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 ...
随机推荐
- CALayer实现遮罩效果
#import "ViewController.h" @interface ViewController () @property(nonatomic,strong)CALayer ...
- ionic 中使用ion-slide-box
ion-slide-box 用法: <ion-slide-box class="slide" auto-play="true" does-continue ...
- [转]oracle 11g 忘记 默认用户密码
本文转自:http://blog.csdn.net/huangbiao86/article/details/6595052 首先启动sqlplus 输入用户名:sqlplus / as sysdba ...
- 转:YUV RGB 常见视频格式解析
转: http://www.cnblogs.com/qinjunni/archive/2012/02/23/2364446.html YUV RGB 常见视频格式解析 I420是YUV格式的一种,而Y ...
- 修改的某人的SqlHelper FOR ODBC
随便找来的,源作者不明. 本来是SQL SERVER 的 修改为 ODBC使用. 并且修改了连接字符串,可以允许修改一次. using System; using System.Collections ...
- Nodejs之WebSocket
文章导读: 一.概述-what's WebSocket? 二.运行在浏览器中的WebSocket客户端+使用ws模块搭建的简单服务器 三.Node中的WebSocket 四.socket.io 五.扩 ...
- 兼容性调试-- 在谷歌浏览器中,td 设置colspan的失效的问题
通过设置table width="100%"table-layout="fixed" 解决
- ASP.NET 状态的传递和保存
1,HTTP协议是无状态的.服务器不会记住上次给浏览器的处理结果,如果需要上次处理结果(上次状态)就需要浏览器把处理结果值(上次状态)再次给服务器. 2,URL传值:通过URL参数或者通过Form表单 ...
- Android ViewPager的简单实现
研究了两天ViewPager,看了几篇网上的帖子,但总的来说看得一头雾水,理不清头绪,偶然发现了一篇简单易懂的帖子,讲的调理比较清晰,原文链接附在文后. 在本例中使用ViewPager + Fra ...
- MVC常用 ActionResult
1.EmptyResult 2.ContentResult 3.FileResult 4.JavaScriptResult 5.JsonResult 6.HttpStatusCodeResult 7. ...