【发布时间】:2018-04-03 16:06:16
【问题描述】:
我正在尝试通过自定义浏览器将新字段添加到采购订单屏幕 (PO301000)。我通过“新建字段”按钮创建了该字段,并稍微编辑了“数据访问”以为该字段提供默认参数。这是数据访问中的代码:
[PXDBDecimal]
[PXDefault(TypeCode.Decimal, "0.0")]
[PXUIField(DisplayName="Weight Total")]
此字段将用于计算采购订单的总重量,我希望将其存储在数据库中。 发布时出现此错误:
An error while publishing the database item POOrder
with the message:
Nullable object must have a value.
我尝试将PXDBDecimal 更改为PXDBQuantity。这必须通过自定义浏览器而不是数据库本身来完成,因为该项目将在我无法访问数据库的 SaaS 托管站点上进行。我也尝试过仅通过 DAC 创建字段,但在尝试打开页面时收到此错误:
Invalid column name 'UsrWeightTotal'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'UsrWeightTotal'.
【问题讨论】:
-
您需要项目中的表条目。如果您查看项目 xml,您有吗?同样对于 PXDefault,您是说所有记录(包括以前的订单)都需要一个值。通过更改对该字段的 PXDefault 的持久检查来允许以前的记录为空值会很好
-
我在项目 XML 中添加了 PersistingCheck=PXPersistingCheck.Nothing 并且表是 POOrder,我仍然遇到同样的问题。
-
在发布过程中您在哪里得到错误?验证期间?
-
不,在更新数据库的那一刻之后。
-
Usr 字段设置是否在 SQL 中可以为空?否则它需要一个 sql 默认值为零