将过滤器传递给odata

2020-09-23 09:23发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)您好,社区,有人知道如何将多个参...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


您好,社区,有人知道如何将多个参数传递给odata吗? 看起来我是这样做的:

 nextActivities:function(){
 var oTableClear = this.getView()。byId(" tabla");
 oTableClear.destroyItems();
//Obtenemos la fecha y Asesor
 var fecha = this.byId(" lFecha")。getText();
 var asesor = this.byId(" usuario")。getValue();

 var oTable = this.getView()。byId(" tabla");
 var sURI ="/img/sap/opu/odata/SAP/ZERP_ACTIVIDADES_SRV";
 var oDataModel = new ODataModel(sURI,true);
 var oModel = new sap.ui.model.json.JSONModel();
 var oFilter = new Filter(" Asesor"," EQ",asesor);
 oDataModel.read("/img/ReservaNextSet",{
 过滤器:[oFilter],
 成功:函数(oData,响应){
 var oResults = oData.results;
 oModel.setData(oData.results);
 oTable.setModel(oModel);
 }


 });
 },
 

我尝试了此操作,但出现错误:

 [new Filter(" Asesor"," EQ",asesor),
 new Filter(" timestamp"," EQ",fecha)];

 或这样的错误:
 var oFilter,aFilter;
 oFilter = [];
 oFilter.push(new Filter(" Asesor"," EQ",asesor));
 oFilter.push(new Filter(" timestamp"," EQ",fecha));
 oDataModel.read("/img/ReservaNextSet",{
 过滤器:[oFilter],



 和这个:(没有错误,但是在表中it_filter_select_options没有捕获到任何东西)

 var oFilter0 = new Filter(" Asesor"," EQ",asesor);
 var oFilter1 = new Filter(" timestamp"," EQ",fecha);
 var oFilter = new Filter([oFilter0,oFilter1],false);

 oDataModel.read("/img/ReservaNextSet",{
 过滤器:[oFilter],




 像这样:



 var oFilter,aFilter;

 oFilter = [];
 oFilter.push(new Filter(" Asesor"," EQ",asesor));
 oFilter.push(new Filter(" timestamp"," EQ",fecha));

 aFilter = new Filter({filters:oFilter,and:false});

 oDataModel.read("/img/ReservaNextSet",{
 过滤器:[aFilter],
 成功:函数(oData,响应){
 var oResults = oData.results;
 oModel.setData(oData.results);
 oTable.setModel(oModel);
 }
 

(11.6 kB)
1条回答
大道至简
2020-09-23 10:01

这是解决方案:注意过滤器:oFilter不是[oFilters],因为它已经是一个数组////数据处理复杂性nextActivities:function(){var oTableClear = this.getView()。byId (" tabla"); oTableClear.destroyItems();

 //Obtenemos la fecha y Asesor
             var fecha = this.byId(" lFecha")。getText();
             var asesor = this.byId(" usuario")。getValue();

             var oTable = this.getView()。byId(" tabla");
             var sURI ="/img/sap/opu/odata/SAP/ZERP_ACTIVIDADES_SRV";
             var oDataModel = new ODataModel(sURI,true);
             var oModel = new sap.ui.model.json.JSONModel();

             var oFilter;
             oFilter = [];
             oFilter.push(new Filter(" Asesor"," EQ",asesor));
             oFilter.push(new Filter(" timestamp"," EQ",fecha));

             oDataModel.read("/img/ReservaNextSet",{
                 过滤器:oFilter,
                 成功:函数(oData,响应){
                 var oResults = oData.results;
                 oModel.setData(oData.results);
                 oTable.setModel(oModel);
                  }
             });
         }, 

一周热门 更多>