你好,有點新,使用JayData和oData,所以請原諒我的無知。使用JayData過濾標題細節表 - 內部加入SQL,oData
這是我的對象結構:
$data.Entity.extend('PlannerModel.vMasterPlanner', {
'Sequence_Number': { key:true,type:'Edm.Int32',nullable:false,required:true },
'Scenario_Name': { type:'Edm.String',nullable:true,maxLength:250 },
'Activity_ID': { type:'Edm.String',nullable:false,required:true,maxLength:250 },
'Activity_Description': { type:'Edm.String',nullable:true,maxLength:500 },
'Object_ID': { type:'Edm.String',nullable:true,maxLength:250 },
'Object_Description': { type:'Edm.String',nullable:true,maxLength:400 },
'Operation_Code': { type:'Edm.String',nullable:false,required:true,maxLength:250 },
'Operation_Description': { type:'Edm.String',nullable:true,maxLength:50 },
'Crew_ID': { type:'Edm.String',nullable:true,maxLength:250 },
'Crew_Name': { type:'Edm.String',nullable:true,maxLength:50 },
'Period': { type:'Edm.Int32',nullable:true },
'vActivity': { type:'PlannerModel.vActivity',required:true,inverseProperty:'vMasterPlanners' } });
$data.Entity.extend('PlannerModel.vActivity', {
'Activity_ID': { key:true,type:'Edm.String',nullable:false,computed:true },
'Activity_Name': { type:'Edm.String',nullable:false,required:true },
'vMasterPlanners': { type:'Array',elementType:'PlannerModel.vMasterPlanner',inverseProperty:'vActivity' } });
$data.EntityContext.extend('PlannerServiceLibrary.PlannerEntities', {
ProgressDetails: { type: $data.EntitySet, elementType: PlannerModel.ProgressDetails },
ProgressHeaders: { type: $data.EntitySet, elementType: PlannerModel.ProgressHeader },
vCrews: { type: $data.EntitySet, elementType: PlannerModel.vCrew },
vPeriods: { type: $data.EntitySet, elementType: PlannerModel.vPeriod },
vOperations: { type: $data.EntitySet, elementType: PlannerModel.vOperation },
vActivities: { type: $data.EntitySet, elementType: PlannerModel.vActivity },
vMasterPlanners: { type: $data.EntitySet, elementType: PlannerModel.vMasterPlanner } });
只是一點點的解釋: 表規劃大師,是一個詳細的表,表的活動是頭表 我需要選擇所有從活動表(活動頭),其中,其在例如細節表中找到的船員ID = 2 我怎樣才能做到這一點使用ODATA和JayData
現在使用
provider.vActivities.filter(function (ac) {
return ac.vMasterPlanners.Crew_ID == "FM2_F/W" })
.toArray(function (e) {
console.log(e);
});
,這是錯誤未知的表達式類型來處理:EntitySetExpression 本地主機/移動網絡/ htdocs中/資產/ jayData/jaydata.js 線89
請幫助任何人!
謝謝!
你可以嘗試使用表格給我一個例子我提供了什麼?我已經看到這篇文章,我不明白你在過濾器中再次調用這個變量subFilter的方式謝謝! –
嗨它應該是這樣的:var subFilter = provider.vMasterPlanner.filter(function(ac){return ac.Crew_ID ==「FM2_F/W」;});提供者.vActivities.filter(函數(ac){ac.vMasterPlanners.some(this.subfilter);},{subfilter:subfilter})。toArray(... –
在這種情況下你只需要'some'或'every' (1..n),1..1或者n..1不需要,'some'表示至少有一條記錄匹配,所有記錄必須匹配 –