DataPower 2 Sorting


Datapower 2 will not load a file in a sorted format in the way Datapower 1 used to.

The sort can be saved and selected when the file is reloaded but the file will not automatically be sorted.

Can you help?


The problem here is that DataPower 2 allows multiple sort orders, whereas DataPower 1 only allowed the underlying records to be sorted, which meant there was only a single sort order active at any one time.

When you perform a sort under DataPower 2, it behaves much more like a subset, in that you can toggle between the new sort order and the old one, and the sort is lost if you close the database.

To make the sort order permanent, you need to give your query a name by entering one in the toolbar at the top of the window when you set up the sort order, then attach that query to your layout so that it's used by default.

To attach a query to a layout, you need to be in Edit Layout mode, then chose Query/Table=>Attach=><queryname> from the menu.

Note that each layout can have a separate sort order if you want, so if you want all your layouts to have the new sort order you need to attach each in turn to the named sort query.

If you want the sort order to be maintained permanently, so it's stored in the main database and is immediately available when you reload the database (rather than being recalculated when you open it), you should set the 'Keep index' flag in the toolbar.

When you perform a sort, DataPower 2 creates a 'secondary index' in the order you specify, which is then used to fetch the underlying records in the table in the order desired. The order of the underlying records does not change. This allows you to set up a number of alternative sort orders and switch quickly between them, as you can just choose your desired sort order from the Query=>View/Run menu, or even attach scripts to buttons on the background of your layout to switch to a given sort order.

DataPower 1 used to sort the actual underlying records, which is why the sort order applied to all layouts, and remained in force after you closed and reopened the database.

DataPower 2 can also sort the underlying records in this way, if you want it to - you need to edit the layouts and choose Query/Table => Edit => Clustering key. However, since all secondary indexes must store the clustering key of each record, you should be careful not to use a very long clustering key.

Top of page