MicroStrategy ONE

Preferences Usage Example

This example explains the implementation of preferences such that different users can view the same report grid differently based on their individual preferences.The page configuration file is responsible for the placement of visual components on a MicroStrategy Web page, while the style catalog configuration file is responsible for the presentation and rendering of those components on the page. Depending upon various values for various preferences, a page’s visual components may require being rendered differently.

For example, suppose a user’s user-level preference for viewing grids is set to use a specific autostyle as defined in the project metadata. Now suppose that another user’s user-level preference is set to use the report’s default autostyle, rather than a specific user-defined autostyle. Since both users access the same Report Execution page in MicroStrategy Web, this page should be able to use its given set of instructions to render the same grid differently for different users with different preferences.

For examples such as this, the page configuration file uses it’s top-level <styles> node to override default <style> definitions stored in the style catalog configuration file.

The <styles> node contains child <style> nodes that can be used to re-define <style> definitions that have already been defined in the style catalog configuration file. For example, in the style catalog configuration file, ReportGridStyle is defined as follows:

<Style description="Style: Display Report Grid in default Style" name="ReportGridStyle"

 transform="CustomReportGridTransformImpl">

  <ActualParameters>

  <ActualParameter name="useIFrame" type="4" value="true"/>

  <ActualParameter name="reportExecution" type="4" value="true"/>

  <ActualParameter name="cssUseFileContent" type="4" value="true"/>

  </ActualParameters>

</Style>

In the page configuration file, the ReportGridStyle is re-defined as follows:

<style name="ReportGridStyle">

 <properties>

  <property name="useBuiltInFormat" source="preference" type="string" value="useBuiltInFormat"/>

  <property name="cssFile" source="preference" type="string" value="defGridStyle"/>

  <property name="showPivot" source="browserSetting" type="string" value="pivB"/>

  <property name="showRemove" source="browserSetting" type="string" value="pivB"/>

  <property name="showSortButtonsForAttributes" source="browserSetting" type="string"

 value="sSrt"/>

  <property name="showSortButtonsForMetrics" source="browserSetting" type="string"

 value="sSrt"/>

  <property name="showSubtitle" source="preference" type="string" value="showSubtitle"/>

  <property name="drillRetainParent" source="preference" type="string" value="drillRetainParent"/>

  <property name="drillRetainThresholds" source="preference" type="string"

 value="drillRetainThresholds"/>

  <property name="wrapRowHeader" source="preference" type="string" value="wrapRowHeader"/>

  <property name="wrapMetricValue" source="preference" type="string" value="wrapMetricValue"/>

  <property name="showDescriptionAsTooltip" source="preference" type="int"

 value="showDescriptionAsTooltip"/>

 </properties>

</style>

Attribute definitions for <property>:

  • name— the name of the formal parameter

  • source— preference if the value should be retrieved from metadata-based preferences, or browserSetting if the value should be retrieved from a user’s browser cookies

  • type— string, integer, or boolean

  • value: for metadata-based preferences, the name of the preference in the sys_definitions.xml file; for browser-based preferences, the name of the <browser-setting> that should be used. In either case, the value associated with the named preference or browser-setting is used. (Note that the value specified in the given <browser-setting> is used only if the cookie is not found on the user’s machine)

Note:

  • The definition of the <style> is constrained to using the same formal parameters available in the transform upon which this <style> is based (as specified in the style catalog configuration file).

  • Any properties re-defined in the page configuration file take precedence over those defined in the style catalog configuration file.