How is the QuickBaseDTOArrayCollection different from an ArrayCollection?

Apart from the name, there are some important properties and methods that make it more useful in the context of writing your Flex code.

You can leverage the framework and use QuickBaseDTOArrayCollection to keep your data up to date and avoid having to do the low-level programming to acheive the same otherwise.

I'll try and explain this with some very simple code snippets.

The following is defined in the model.

         public var developersDTO: Developers_DTO = new Developers_DTO();
         public var developersList:  QuickBaseDTOArrayCollection ;

where the Developers_DTO is the Data Transfer Object for an individual record and it handles the marshalling and umarshalling of the fields of the record. It is automatically generated as part of the project when you use the "Generate data transfer objects" as part of the IPP plugin.

I instantiate this list in the view in the initPanel() or as appropriate. This indicates what fields of the record you want to retrieve.

model.developersList = new QuickBaseDTOArrayCollection
                   (Developers_DTO, true, "",
                   "Name.Company.EmailContact…", // fields are dot-separated. Not all shown

You initialize the list, which essentially populates the list, something along the lines of below.


This populated list can then be used as a dataProvider in a DataGrid just like a regular ArrayCollection, through the magic of Flex databinding and the QuickBaseDTOArraycollection's own magic of updating itself when data on the server changes. So, whenever a record is added, updated or deleted by any user (not necessarily the current user) this is reflected in the view.

          <mx:DataGrid id="developersViewGrid" change="true" wordWrap="true" dataProvider="{model.developersList}"

You can also force the update when you know things have changed (i.e. because you stored a record in the current client) as below


Most importantly, by using the QuickBaseDTOArrayCollection to keep your data up to date, your application is imposing the smallest possible burden on the server, in particular, if data isn't changing, you aren't touching the database, and therefore are reducing your usage charges.

It's certainly possible to duplicate the functionality of the QuickBaseDTOArrayCollection yourself using a standard ArrayCollection, but why do all that low-level programming yourself?  Focus on your business logic and let the framework take care of the wiring for you.

You can get more details in the Programmer's Guide.






Leave a Reply

Your email address will not be published. Required fields are marked *