2015-01-06 3 views
3

사용자 스토리 및 결함에서 결합 된 레코드 세트를 가져 오려고합니다. 각 작업 (예 : 결함 상태! = 폐쇄 및 사용자 스토리 직접 하위 개수 = 0)에 대한 필터가 있지만 결합 된 쿼리 또는 작동 할 사용자 정의 쿼리를 가질 수 없습니다. 예를 들어, 다음 코드는 User Stories를 반환하지만 모든 결함을 본질적으로 걸러냅니다.Rally SDK 2.0 - 다중 유형 아티팩트 필터링

이렇게하는 방법은 여러 가지가 있지만 각 유형별 필터를 사용하여 여러 유형의 조합 된 결과 집합을 얻는 방법은 확실합니까? 감사.

_getData: function(name) { 
    var deferred = Ext.create('Deft.Deferred'); 

    Ext.create('Rally.data.wsapi.artifact.Store', { 
     models: ['UserStory', 'Defect'], 
     pageSize: 2000, 
     fetch: ['c_MyCustomField', 'ScheduleState', 'PlanEstimate', 'Name'], 
     filters: [ 
      { property: 'ScheduleState', operator: '!=', value: 'Accepted' }, 
      function(item){ 
       var dirChildCountIsGood = false; 
       try 
       { 
        if (item.DirectChildrenCount > 0) 
         dirChildCountIsGood = false; 
       } 
       catch(ex) {} 
       return false; 
      }, 
      /* or */{ property: 'DirectChildrenCount', operator: '=', value: '0' } 
      //{ property: 'State', operator: '!=', value: 'Closed' } 
     ], 
     sorters: [ 
      { property: 'c_MyCustomField', direction: 'ASC'} // Same field for both User Stories and Defects 
     ], 
     autoLoad: true, 
     listeners: { 
      scope: this, 
      load: this._onRecordsLoaded 
     } 
    }); 
    console.log('Call to WSAPI store complete.'); 
    return deferred; 
} 

답변

1

이것은 유물 종점의 불행한 기이함입니다. 특수한 숨겨진 TypeDefOid 특성을 사용하여 쿼리를 처리하면 올바른 절에만 적용되는 여러 절을 얻을 수 있습니다. 장기간에 걸쳐 이러한 유형의 시나리오를보다 잘 지원하기 위해 WSAPI 쿼리 언어를 향상 시키길 바랍니다.

빌드이 개 때문에 같은 필터 : 다음

var nonClosedDefectsFilter = Rally.data.wsapi.Filter.and([ 
    { 
     property: 'TypeDefOid', 
     value: 12345 //replace with your defect typedef oid 
    }, 
    { 
     property: 'State', 
     operator: '!=' 
     value: 'Closed' 
    } 
]); 

var leafStoryFilter = Rally.data.wsapi.Filter.and([ 
    { 
     property: 'TypeDefOid', 
     value: 23456 //replace with your story typedef oid 
    }, 
    { 
     property: 'DirectChildrenCount', 
     value: 0 
    } 
]); 

그리고 또는 함께 사용하면 작성시 상점에를 통과 할 때 그들 :

Ext.create('Rally.data.wsapi.artifact.Store', { 
    //other config from above omitted for brevity 
    filters: [nonClosedDefectsFilter.or(leafStoryFilter)] 
}); 
관련 문제