我正在尝试执行以下代码:
static void ProjTableQuery(Args _args)
{
Query query;
QueryBuildDataSource qbds1;
QueryBuildDataSource qbds2;
QueryBuildRange qbr1;
QueryBuildRange qbr2;
QueryRun queryRun;
ProjTable projTable;
query = new Query();
qbds1 = query.addDataSource(tableNum(ProjTable));
qbds1.addSortField(
fieldNum(ProjTable, Name),
SortOrder::Ascending);
//qbr1 = qbds1.addRange(fieldNum(ProjTable, Type));
//qbr1.value(queryValue(ProjType::FixedPrice));
qbr2 = qbds1.addRange(fieldNum(ProjTable, ProjId));
qbr2.value(queryValue('0') + '*');
qbds2 = qbds1.addDataSource(tableNum(ProjEmplTrans));
qbds2.relations(true);
qbds2.joinMode(JoinMode::InnerJoin);
queryRun = new QueryRun(query);
while (queryRun.next())
{
projTable = queryRun.get(tableNum(ProjTable));
info(strFmt("%1 %2 %3", projTable.ProjId, projTable.Name, projTable.Type));
}
}
注释掉的那两条线可以正常工作。但是如果我取消注释它们,它将不再运行并且不会显示任何错误消息。
据我所见,ProjType 是一个枚举,我确信我已经在 SQL 中检查了 FixedPrice 值。