简体   繁体   English

找不到Microsoft动态NAV表字段

[英]Microsoft Dynamics NAV table fields not found

I have created two new tables in our Dynamics NAV 2013 installation: 50086 Order By Period and 50089 Item Sales By Period. 我在Dynamics NAV 2013安装中创建了两个新表:50086按周期订购和50089按周期销售。 Each contains Date, Decimal, Integer and Text fields, as well as the Code fields used in the key. 每个字段都包含“日期”,“十进制”,“整数”和“文本”字段,以及键中使用的“代码”字段。 I left all field properties as their defaults. 我将所有字段属性保留为默认值。 When referring to the tables in my codeunit some, but not all, of the fields cause compile errors because they are not recognised, with the error "You have specified an unknown variable." 当引用我的代码单元中的表时,某些(不是全部)字段会导致编译错误,因为无法识别它们,错误为“您已指定未知变量”。 In the codeunit I have the tables referenced as local variables of type Record. 在代码单元中,我将表引用为Record类型的局部变量。

I have tried a number of different ways of referring to the table fields in case the error was in the code but all cause the same error. 我尝试了多种不同的方式来引用表字段,以防错误出现在代码中,但是都会导致相同的错误。 My current code is: 我当前的代码是:

ItemRevenue.VALIDATE("Last Period Orders", 1);

Recompiling the objects (tables and codeunit) has not fixed the problem. 重新编译对象(表和代码单元)不能解决问题。 In order to force the compiler to use the latest version of the tables I have removed all references to the tables from the codeunit, recompiled the tables, then added the references back and recompiled the codeunit. 为了强制编译器使用表的最新版本,我从代码单元中删除了对该表的所有引用,重新编译了这些表,然后又添加了这些引用并重新编译了代码单元。 This hasn't corrected it, the same fields are still causing compile errors. 这尚未纠正,相同的字段仍会导致编译错误。

All the table fields are present in the SQL Server tables. 所有表字段都显示在SQL Server表中。

What should I do to make all the new table fields visible to the compiler? 如何使所有新表字段对编译器可见?

I never worked out why the compiler didn't recognise the table field names but using the C/AL Symbol Menu to add the field names instead of typing them, or copying and pasting them from the table definition, created compilable code. 我从来没有弄清楚过为什么编译器无法识别表字段名称,而是使用C / AL符号菜单添加字段名称而不是键入它们,或者从表定义中复制和粘贴它们来创建可编译代码的原因。 To the human eye there was no difference in the field names but the compiler recognised the field names inserted via the C/AL Symbol Menu whereas it hadn't recognised them before. 在人眼中,字段名没有什么区别,但是编译器可以识别通过C / AL符号菜单插入的字段名,而以前却无法识别它们。

If you adding fields to table while having codeunit referencing the table opened then C/AL will throw this error until you reopen codeunit. 如果在打开代码单元引用表的同时向表中添加字段,则C / AL将抛出此错误,直到您重新打开代码单元。 This is the only way to refresh table definition for codeunit. 这是刷新代码单元表定义的唯一方法。

However if the codeunit declared as SingleInstance then just reopen codeunit is not sufficient. 但是,如果将代码单元声明为SingleInstance,则仅重新打开代码单元是不够的。 You have to restart client application or as it called in newer versions Development Environment. 您必须重新启动客户端应用程序或在更高版本的开发环境中调用它。 That will refresh table definition for singleinstance codeunit. 这将刷新单实例代码单元的表定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM