修改后的 table 值
Modified table value
我想创建条件以在 modify/update table 数据之前检查同一数据源中的其他 table 字段。
例如我有 table 个学生,table 中的字段是 "status"、"name" 和 "score"。状态为枚举类型,默认为 "not allow"。用户可以使用数据网格形式更改状态字段。
我想创建条件,如果得分 > 50,状态可以更改为 "allow",否则无法更改。谢谢
使用验证怎么样?
在 table 或数据源上使用 validateField 或 validateWrite,您可以测试所选值是否有效。
也可以使用数据源或控件上的验证方法。
在 AOT 的表格或表单节点中搜索数千个示例。
This answer 适用于大多数 "check the value of an entered field"。
正如 Jan 已经写过的,解决这个问题的一种方法是覆盖你的学生 table 的 validateField
方法。每当用户以 table 的形式更改 table 的字段时,都会调用此方法。在该方法中,您可以编写一些代码来处理对 Status
字段的更改,例如
public boolean validateField(FieldId _fieldId)
{
boolean ret;
ret = super();
switch (_fieldId)
{
case fieldNum(MyStudentTable, Status):
if (this.Status == MyStatus::Allow
&& this.Score <= 50)
{
ret = checkFailed("Score must be greater than 50 to Change the Status."); // TODO create a label
}
break;
}
return ret;
}
我想创建条件以在 modify/update table 数据之前检查同一数据源中的其他 table 字段。
例如我有 table 个学生,table 中的字段是 "status"、"name" 和 "score"。状态为枚举类型,默认为 "not allow"。用户可以使用数据网格形式更改状态字段。
我想创建条件,如果得分 > 50,状态可以更改为 "allow",否则无法更改。谢谢
使用验证怎么样?
在 table 或数据源上使用 validateField 或 validateWrite,您可以测试所选值是否有效。
也可以使用数据源或控件上的验证方法。
在 AOT 的表格或表单节点中搜索数千个示例。
This answer 适用于大多数 "check the value of an entered field"。
正如 Jan 已经写过的,解决这个问题的一种方法是覆盖你的学生 table 的 validateField
方法。每当用户以 table 的形式更改 table 的字段时,都会调用此方法。在该方法中,您可以编写一些代码来处理对 Status
字段的更改,例如
public boolean validateField(FieldId _fieldId)
{
boolean ret;
ret = super();
switch (_fieldId)
{
case fieldNum(MyStudentTable, Status):
if (this.Status == MyStatus::Allow
&& this.Score <= 50)
{
ret = checkFailed("Score must be greater than 50 to Change the Status."); // TODO create a label
}
break;
}
return ret;
}