Pergunta

Is it possible to build a wsapi.Filter to filter out iterations based on StartDate and EndDate? I want to do something like

{
  property: 'StartDate',
  operator: '>=',
  value: myStartDate
}

or

{
  property: 'EndDate',
  operator: '<=',
  value: myEndDate
}

but it doesn't seem to be working. I can't even figure out how to manually query the iterations on the Web Services API page; I'm not sure how to format the date string properly.

Foi útil?

Solução

You may try this code that filters by StarDate within the last 90 days. Please see the output in the console:

Ext.define('CustomApp', { extend: 'Rally.app.App', componentCls: 'app',

        launch: function() {

        this.loadIterations(); 
        },

loadIterations: function() {
        var millisecondsInDay = 86400000;            
        var currentDate = new Date();
        var startDate = new Date(currentDate - millisecondsInDay*90);
        var startDateUTC = startDate.toISOString();
        console.log('startDateUTC',startDateUTC);
        console.log('startDate',startDate);
        var iterations = Ext.create('Rally.data.WsapiDataStore', {
            model: 'Iteration',
            autoLoad: true,
            fetch: ['ObjectID', 'Name', 'StartDate', 'PlannedVelocity'],
            filters:[
                {
                        property: 'StartDate',
                        operator: '>=',
                        value: startDateUTC
                }
            ],
            sorters: [
                {property: 'StartDate', direction: 'ASC'}
            ],
            listeners: {
                load: function(store, data, success) {
                    Ext.Array.each(data, function(record) {
                        console.info('ID: ', record.get('ObjectID'), 
                            '  Name: ', record.get('Name'),                             
                            '  StartDate: ', record.get('StartDate'), 
                            '  PlannedVelocity: ', record.get('PlannedVelocity'));
                    });
                }, scope: this
            }
        });        
}    
});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top