Wijmo OLAP: Answer Recurring Questions with Pre-Defined Views

As you can see from the previous post, it is really easy to build views by dragging fields within the PivotPanel control. If your users are familiar with Excel’s Pivot Tables, they will feel right at home with Wijmo OLAP. But you may want your application to include some pre-defined views to answer recurring questions. In these cases, it would be nice to store the pre-defined views and allow users to pick them from a list instead of re-building them from scratch each time.

Wijmo’s PivotEngine class has a viewDefinition property that allows you to save and restore views using a simple JSON string. This makes it easy to build a catalog of standard questions so users can get the view they want instantly. The OlapIntro sample contains some code that implements this functionality. The HTML looks like this:

Use the **viewDefinition** property to save and restore
view definitions. For example:
Save View
Load View

Or build a list of pre-defined views for the user to pick from. For example:

[/code] The code behind starts by defining an app.viewDefs array containing pre-defined views. Each entry in the array has a name and a JSON string representing the view definition: