2

I need to pull the changeset belongs to userstory along with build changesets.

// load the data
_loadData : function(loadUi) {
console.log('load data started');
Ext.create('Rally.data.wsapi.Store', {
    model : ['User Story','Build']
    autoLoad : true,
    listeners : {
        load : function(myStore, data, success) {
            return this._processChangesetData(myStore, data, loadUi);
        },
    scope : this
    },
    fetch : [ 'FormattedID', 'Name', 'ScheduleState','Changesets', 'Iteration', 'Release' ,'Number', 'Status','Uri',]
});
},
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
sharan
  • 63
  • 1
  • 10
  • You may need to post a little more information and it seems to be a little more geared towards your server's RallyAPI implementation (unless you are hitting the api directly from the client, which you shouldnt.) Sidenote, im not certain, but it also would be logical to assume your UserStory model wouldnt have a space. In addition to that, you should check associated relationships between models if you want to include both within a single store.... A little more information on how you are trying to build your data store would be helpful. :) – polkattt Jul 21 '17 at 02:56

1 Answers1

1

This is a bit complicated. Stories have a Changesets collection, and each Changeset entry in there has a Builds collection.

So, in pseudocode:

1) Load stories, making sure to fetch Changesets
2) For each story loaded in step 1, load the Changesets collection, making sure to fetch Builds
3) For each changeset loaded in step2, load the Builds collection

There's a good guide in the docs on how to work with collections: https://help.rallydev.com/apps/2.1/doc/#!/guide/collections_in_v2-section-collection-fetching

Note that this will likely be very slow due to the volume of nested loads occurring in loops. Is there a way you can filter your data down to avoid loading everything? What is the question you're trying to answer with all this data?

Code example:

Ext.create('Rally.data.wsapi.Store', {
    model: 'UserStory',
    fetch: ['Changesets'],
    autoLoad: true,
    listeners: {
        load: function(store, records) {
            records.each(function(story) {
                story.changeSets = story.getCollection('Changesets');
                story.changeSets.load({
                    fetch: ['Builds'],
                    callback: function(changesets) {
                        changesets.each(function(changeset) {
                            changeset.builds = changeset.getCollection('Builds');
                            changeset.builds.load({
                                fetch: ['Number', 'Duration', 'Status', 'Uri'],
                                callback: function(builds) {
                                    builds.each(function(build) {
                                        console.log(build);
                                    });
                                }
                            });
                        });
                    }
                });    
            });
        }
    }
});  

As mentioned above, I would not recommend running this code in production. It will be very slow. If you can limit the top level to a specific story it probably won't be too bad.

Kyle Morse
  • 8,390
  • 2
  • 15
  • 16
  • @Morse thanks for information it was helpful ,now i'm able to get the builds in changesets so i'm itirating each changeset and getting builds link which has count value equals to 1, can please help out how can i make call back function to hit builds "_ref" link so that i can get deatils of 'Number', 'Status','Uri' related to build. "Builds":{ "_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/BuildDefinition/133668244192/Builds", "_type": "Build", "Count": 2 } – sharan Jul 24 '17 at 06:39
  • @Morse thanks for reply , i have taken care of -limit the top level to a specific story under perticualr release .Its performance is good now. – sharan Jul 25 '17 at 05:02