我真的找不到任何关于这个的东西,我真的无法弄清楚。无论如何,我已经创建了一个视图,我需要在 x++ 中使用 query/QueryRun 等进行过滤。
我正在尝试做的选择语句看起来像这样
while select salestable order by PtsWebDeliveryDate, salesId
where
(SalesTable.SalesStatus == SalesStatus::Delivered && !SalesTable.PtsProdNorwood && SalesTable.CustAccount != acc && SalesTable.InvoiceAccount != acc &&
salestable.PtsWebDeliveryDate >= today() && salestable.PtsWebDeliveryDate <= today()+daysahead)
||
(
SalesTable.SalesStatus == SalesStatus::Backorder && SalesTable.SalesType == SalesType::Sales && !SalesTable.PtsProdNorwood &&
SalesTable.CustAccount != acc && SalesTable.InvoiceAccount != acc &&
(
(salesTable.PtsSalesorderPacked && salestable.PtsWebDeliveryDate >= today() && salestable.PtsWebDeliveryDate <= today()+daysAhead)
||
(!salesTable.PtsSalesorderPacked && salestable.PtsWebDeliveryDate >= d && salestable.PtsWebDeliveryDate <= today()+daysahead))
)
{
//Do stuff
}
如您所见,我有需要使用的 som OR 运算符。我已经开始在 x++ 中构建查询,这就是我得到的:
q = new Query();
q.addDataSource(TableNum("packlistview"));
q.dataSourceNo(1).addSortField(fn[_OrderBy], _direction);
q.dataSourceNo(1).addRange(fieldNum(PackListView, SalesStatus)).value(queryValue(SalesStatus::Delivered));
q.dataSourceNo(1).addRange(fieldNum(PackListView, PtsProdnorwood)).value(queryValue(NoYes::No));
q.dataSourceNo(1).addRange(fieldNum(PackListView, CustAccount)).value(queryValue(!acc));
q.dataSourceNo(1).addRange(fieldNum(PackListView, PtsWebDeliveryDate)).value(queryrange(today(),today()+daysahead));
//OR
q.dataSourceNo(1).addRange(fieldNum(PackListView, SalesStatus)).value(queryValue(SalesStatus::Backorder));
q.dataSourceNo(1).addRange(fieldNum(PackListView, SalesType)).value(queryValue(SalesType::Sales));
q.dataSourceNo(1).addRange(fieldNum(PackListView, PtsProdnorwood)).value(queryValue(false));
q.dataSourceNo(1).addRange(fieldNum(PackListView, CustAccount)).value(queryValue(!acc));
q.dataSourceNo(1).addRange(fieldNum(PackListView, InvoiceAccount)).value(queryValue(!acc));
q.dataSourceNo(1).addRange(fieldNum(PackListView, PtsSalesorderPacked)).value(queryValue(false));
q.dataSourceNo(1).addRange(fieldNum(PackListView, PtsWebDeliveryDate)).value(queryrange(d, today()+daysahead));
//OR
q.dataSourceNo(1).addRange(fieldNum(PackListView, PtsSalesorderPacked)).value(queryValue(false));
q.dataSourceNo(1).addRange(fieldNum(PackListView, PtsWebDeliveryDate)).value(queryrange(d, today()+daysahead));
qr = new queryRun(q);
while( qr.next())// && counter < 100
{
//Do stuff
}
那么如何将 OR 运算符与此合并?
干杯伙计们:)