问题
Hello Am kinda new and using JayData and oData so please forgive my ignorance.
This is my object structure :
$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 } });
Just a little explanation : Table Master planner is a detail table and Table activity is the header table I need to select all the activities from the activity table (header) where the crew ID which is found in the detail table for example = 2 how can i do that using oData and JayData
am currently using
provider.vActivities.filter(function (ac) {
return ac.vMasterPlanners.Crew_ID == "FM2_F/W" })
.toArray(function (e) {
console.log(e);
});
and this is the error Unknown expression type to handle: EntitySetExpression localhost/mobile-web/htdocs/assets/jayData/jaydata.js Line 89
Please help anyone !!
Thank You !
回答1:
You need 'some' or 'every' operator, see this http://jaydata.org/blog/using-some-and-every-with-jaydata-odata-provider
回答2:
It looks like a known issue I have added it in to github http://github.com/jaydata/jaydata/issues/70
来源:https://stackoverflow.com/questions/14081989/using-jaydata-to-filter-header-detail-table-inner-join-sql-odata