SAPUI5在filterOperator中使用OR

时间:2016-10-12 09:55:42

标签: sapui5

我需要一个过滤条件......

StartDate< = effectiveFrom OR StartDate< = effectiveFrom + 7天。

如何在以下代码中添加OR语句?

filters: [
    new Filter("ShopId", FilterOperator.EQ, that.sitId),
    new Filter("CategoryId", FilterOperator.EQ, "S"),
    new Filter("ApprovalId", FilterOperator.EQ, "3"),
    new Filter("StartDate", FilterOperator.LE, moment(new Date(effectiveFrom)).toDate()),

1 个答案:

答案 0 :(得分:1)

var f1 = new Filter("StartDate", FilterOperator.LE, moment(new Date(effectiveFrom)).toDate());
var f2 = new Filter("StartDate", FilterOperator.LE, moment(new Date(effectiveFrom)).add(7,'days').toDate());
var filter =  new sap.ui.model.Filter({
    filters: [f1,f2],
    and: false
  })