如何根据显示方法值隐藏表格网格中的记录?
How to hide record in Form grid based on display method value?
我有一个简单的表单,在我的 DataSource 我创建了一个经典的显示方法(名为 calculateAmount)并使用这个方法来显示表单网格中的值。
因此可以仅显示具有 calculateAmount 中特定值的记录,例如我只想显示具有 calculateAmount()[=25= 的记录] > 0 ,其他记录 calculateAmount() < 0 不显示。
所以如果我不能混合使用 Query 和 displayMethod,可能我可以在哪里插入条件(例如 active executeQuery 等) ?
谢谢指教。
考虑以下序列:
- 执行查询被调用,AOT查询被翻译成SQL查询
- 在
executeQuery()
之后从 SQL 服务器获取结果
- 为每条记录调用显示方法,然后在网格
上显示值
因此您不能根据显示方法值在execute query
上添加查询范围。
你可以做的一件事:
- 复制您的数据源 table 并将其 Table 类型 属性 设置为 TempDB
- 在
executeQuery
方法中编写逻辑来填充这个新创建的 table
在这里你可以像这样添加这个条件:
if ([your data source].calculateAmount() > 0)
{
// do not add the record in temp table
}
else
{
// add the record in temp table
}
将您的温度 table 设置为网格的数据源。
希望对您有所帮助!!
我有一个简单的表单,在我的 DataSource 我创建了一个经典的显示方法(名为 calculateAmount)并使用这个方法来显示表单网格中的值。
因此可以仅显示具有 calculateAmount 中特定值的记录,例如我只想显示具有 calculateAmount()[=25= 的记录] > 0 ,其他记录 calculateAmount() < 0 不显示。
所以如果我不能混合使用 Query 和 displayMethod,可能我可以在哪里插入条件(例如 active executeQuery 等) ?
谢谢指教。
考虑以下序列:
- 执行查询被调用,AOT查询被翻译成SQL查询
- 在
executeQuery()
之后从 SQL 服务器获取结果
- 为每条记录调用显示方法,然后在网格 上显示值
因此您不能根据显示方法值在execute query
上添加查询范围。
你可以做的一件事:
- 复制您的数据源 table 并将其 Table 类型 属性 设置为 TempDB
- 在
executeQuery
方法中编写逻辑来填充这个新创建的 table 在这里你可以像这样添加这个条件:
if ([your data source].calculateAmount() > 0) { // do not add the record in temp table } else { // add the record in temp table }
将您的温度 table 设置为网格的数据源。
希望对您有所帮助!!