PDA

View Full Version : Advice requested - Reusing an XML response to populate multiple datastores



RobWilson
24 Dec 2010, 3:31 AM
Hi,

I'm wondering whether it's possible to invoke a web-service (i.e. a login web services) that returns XML that can then be used to populate multiple data stores.

The reason why I ask, is that my login XML response contains many elements, where those elements should populate independent data stores, i.e.

<destinations>
<destination id="1" name="woof"/>
<destination id="2" name="banana"/>
</destinations>
<users>
<user id="1" name="Rob"/>
<user id="2" name="James"/>
</users>

I would like to perform the login request, then the XML be pushed into a destinationStore and userStore with different root elements ('destinations' and 'users').

In addition, is this something that can be done within the designer, or something that would need to be coded manually.

Thanks,
Rob.

Condor
24 Dec 2010, 3:44 AM
You could use:

store1.load({
callback: function(){
store2.loadData(store1.reader.xmlData);
}
});

RobWilson
5 Jan 2011, 8:51 AM
Perfect, thanks. I do have another question relating to XML parsing, but I'll post that separately.

Thanks,
Rob.