User Defined Views
User Defined Views (UDVs) are an m-Power feature allowing your end users to customize applications to their specific needs. At runtime, columns can be selected, hidden, or reordered based upon what your end users require. Additionally, other display aspects can be customized including column names, some formatting, and even styles. Furthermore, these views can be saved and/or defaulted to, making applications highly customizable for end users. Ultimately, developers benefit too, as one application can serve multiple end users without extra work in development.
After taking the latest m-Power update, the User Defined Views (UDV) will show up as a new option in the interface.
This is found by navigating to Admin Menu » System Management. Before you can use this feature in your applications, you must click this button in the interface, which will create the following objects in your data dictionary, where DD is the current data dictionary:
- DD.MRCVIEWS – This table stores all of the UDVs, including the user who created the UDV and if the UDV is the default.
- DD.MRCSTYLES – This table stores some of the UDV styles
- DD.I00001ts – This application is used to retrieve the selected style for the UDV
- DD.I00002ts – This application is used to retrieve the default UDV for an application
- DD.M00001ts – This application is not currently used
- DD.M00010ts –This application is used to maintain UDVs (see HERE for more information)
- DD.MRCViews – This application is used to save and retrieve views at runtime
Once this button has been clicked and the above objects generated, you can begin using UDVs in the current dictionary.
Note: Only data dictionaries utilizing the Sky theme can use UDVs. More information on the sky theme can be found here.
Adding to Apps
UDVs are supported in the Web 2.0 Multiple Record Inquiry and the Web 2.0 Report templates. All newly created applications of these templates will support UDVs, however existing applications will need to be recompiled in order to take advantage of this feature. To do so, open your app and go to the Build and Customize screen. Click the Rebuild Application button, and then specify to overwrite both the HTML and XML in order to add UDVs to this application. Once complete, you will find a new property in the Application Properties called enable_user_defined_views.
To modify this, click the Edit Properties button and then scroll to the bottom of the Program Options tab. Set this to Yes in order to use the UDV feature in this application. Once you set this property to Yes, your application should look similar to the following at runtime:
Note: You must have security enabled for the dictionary in order to use the views. If you do not have security turned on, changing this property will have no effect.
I have previously configured this dictionary for UDVs and I have sign-on security turned on. If we go to a retrieval, we can see that I have built a standard multiple record inquiry over some baseball data. Once compiled, you can enable UDVs for this application by going into the properties and setting the enable_user_defined_views property to Yes.
At runtime, end users will first see this view, if no defaults have been set. To customize the screen, you will need to click on the Field Options button over here on the left. This will open the UDV side panel, where you can begin customizing your application.
First, you can select as many fields as needed in the Select Fields section by clicking in the Available Fields list or searching for the field needed. Fields can be deselected by clicking on the field again so it is not highlighted, or by clicking the X next to the field name above. Fields can also be reordered by dragging and dropping them. Once finished, click the Apply Changes to Application button to see your fields in the main app viewport on the right.
Next, we can format some of the columns on the Cell Format section. In this section, you can specify things like column header, field width, font and background color, and even a class for the selected column. Again, once completed, click the Apply Changes to Application button to see your changes in the main viewport.
Finally, we have the Saved Views section for loading any saved views. All existing views saved by my user or set to be global views will appear here and can be loaded by clicking on it and then clicking the Load Saved View button. Views can also be linked to directly by copying the Current View URL text. Finally, you can save the current view by clicking on Save Current Specifications button. To do so, either give the view a name or choose to replace one of your existing views. Additionally, specify whether you want this view to load by default or not. Once completed, click Save View. As you can see here, the next time I load this application, the view I just created and saved as a default loads immediately.
As a developer, you can maintain the saved views within a certain data dictionary. To do so, navigate in the interface to Admin Menu -> System Management -> User Defined Application Views -> Manage Application Views. This will open the UDV maintainer, where you can view all of the saved UDVs for the current dictionary.
Within this maintainer, you can delete or edit saved UDVs. When editing, you have the option of changing the username or making the UDV global (by removing the username), as well as specifying whether the UDV is the default view or not.
You can specify a global default view for use when an end user first comes to the application by saving a UDV, and then clearing out the Username field and setting the Default? To Yes.
If an end user chooses to save their own default, it will override the global one and be loaded for that user when they next run the application.
Q: I have taken the latest update, but the UDV property does not appear after I recompiled my application.
A: Please make sure you are using the Sky theme, as UDVs are not supported in other themes. More information on the Sky theme can be found here.
If you are running the Sky theme, please ensure you are choosing to overwrite both the HTML and XML when recompiling as there are changes to both the HTML and Application Properties in order to use this feature.
Q: I have set the enable_user_defined_views property to Yes, however I am not seeing this feature at runtime.
A: First, please ensure you have recompiled your application and overwritten the HTML as there are HTML changes required.
If this has been done, then please also confirm that you have sign-on security enabled in this dictionary as this feature requires users to be signed in before it will work.
Q: I have gone into the Manage Application Views screen and changed a UDV to make it the default. However, this does not appear to be working at runtime.
A: Please make sure that no other views for this application and user are set to default. If there is more than one default, you might see this issue where the previously set default is used. To fix, simply set the other UDVs for this application and user to Default? No.
Q: I have promoted my application using the UDV, but I get an error saying the “User Defined Application Views have not yet been installed for this dictionary.”
A: The auto-generated applications must be promoted the first time using UDVs in production for that dictionary. From the server, copy all associated files found in mrcjava/WEB-INF/classes/DD for the following applications: