如何将RecId用作表单中的外键 [英] How to use RecId as a foreign key in a form

查看:183
本文介绍了如何将RecId用作表单中的外键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目表,每个项目在另一个表格中引用另一个项目。表A:Bob:1,Sally:1,Sue:3



表B:1:苹果,2:香蕉,3:橘子

人与他们最喜欢的食物RecId,在People表中引用。



我有一个编辑人员的表单/表格。有没有办法使网格中的FoodRecId StringView转换其值,以便RecId数字在网格中不可见?

我已经编写了多列查找来轻松处理创建正确的关系,但是如果网格中的RecId可以被隐藏/替换,表单将更容易使用 使用 .com / 2011/05 / surrogate-key-in-ax-2012.htmlrel =nofollow>代理键。
使用 RecId 作为外键现在是最佳实践!



更新:确切的步骤可以是在 AX神韵中找到。



如果使用旧版本的AX,请查看 ContactPersonRecId CustTable 表单。
它涉及在表单中隐藏 recId 字段,同时使用另一个编辑字段 ContactPersonName 作为键。 / p>

虽然使用 RecId 作为外键并不违背最佳实践,但通常会避免由于手动处理代理键。


I have a table of items that each reference one other item in another table. We'll say the items are people, and the related items are favorite foods.

Table A: Bob:1, Sally:1, Sue:3

Table B: 1:Apples, 2:Bananas, 3:Oranges

The "people" are tied to their favorite "foods" by the food RecId, refererenced in the People table.

I have a form/grid for editing people. Is there a way to cause the FoodRecId StringView in the grid to convert its value so the RecId numbers are not visible in the grid?

I've already written multi-column lookups to easily handle creating correct relations, but if the RecIds in the grid could be hidden/replaced, the form will be much easier to use.

解决方案

Way easy if you are using AX 2012: use surrogate keys. Use of RecId as foreign keys are now Best Pratice!

Update: The exact steps can be found in AX Musings.

If using an older version of AX then have a look on the use of ContactPersonRecId in the CustTable form. It involves hiding the recId field in the form while using another edit field ContactPersonName as the key.

While the use of RecId as a foreign key is not against Best Practice it is usually avoided due to the complexity of manually handling surrogate keys.

这篇关于如何将RecId用作表单中的外键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆