MicroStrategy ONE

Representation of ReportInstanceModel (Model block)

As mentioned earlier, the server-side layout definition file, PromptsContainerLayout_widget.xml (available in the WEB-INF\xml\layouts\widgets folder of the MicroStrategy Web installation), creates PromptEditor (view block) and ReportInstanceModel (model block) by instantiating them from the Block Library and setting appropriate properties on them.

The value for the “promptQuestions” property defined in ReportInstanceModelmodel block is an item array of block PromptQuestionModels. This value is also set in the server-side layout definition file, PromptsContainerLayout_widget.xml.

The view blocks “ViewStack” and “PromptQuestionViewRoll” from the PromptEditor view block are connected to this “promptQuestions” model block in the representation for the “PromptEditor” block using the modelPath property as shown below.

Copy
<mstrlayout:bSetProperty path="book/modelPath" value="parent/model/promptQuestions"/>

In the example above, the connection is made as follows: the parent of view blocks “ViewStack” and “PromptQuestionViewRoll” is the PromptEditor view block, and the model for that is the ReportInstanceModel model block, which contains the “promptQuestions” model block.

Each item in the “promptQuestions” list is a PromptQuestionModel  that typically contains the "title", "meaning" and other properties for a prompt, in addition to the "answer" property that represents the prompt answer. The value of the “answer” property is a PromptAnswerModel. For example, in case of an Expression prompt, the value for the “answer” property is ExpressionPromptAnswerModel.

A ListModel block is created that has a property called items of type List. Each item element in this list corresponds to a single prompt. As shown in the code below, the getPromptAppBeans method gets a collection of PromptAppBeans under PromptsContainerBean. The getPromptPageWidget method is responsible for transforming the individual PromptAppBeans using the default style or a custom style that has been registered and connected to the prompt through its properties.

Copy
<mstrlayout:bSetProperty path="promptQuestions">
            <mstrlayout:block name="ListModel">
                <mstrlayout:bSetProperty path="valueForm" value="id"/>
                <mstrlayout:bSetProperty path="selectedIndicesList" method="getCurrentPromptPosition"/>
                <mstrlayout:list id="promptIndexList" base="bean" name="getPromptAppBeans">
                    <mstrlayout:bAppendList path="items" method="getPromptPageWidget">
                        <mstrlayout:argument list="promptIndexList" type="com.microstrategy.web.app.beans.PromptAppBean"/>
                        <mstrlayout:argument type="boolean" value="true"/> <!-- model=true; view = false -->
                    </mstrlayout:bAppendList>
                </mstrlayout:list>
            </mstrlayout:block>
</mstrlayout:bSetProperty>

The <mstrlayout:argument type="boolean" value="true"/> <!-- model=true; view = false --> line from the code shown above passes the boolean value "true" to the isDisplayingModel method of the PromptBaseLayout.xml file. PromptBaseLayout.xml then starts filling in the slot for the model block, PromptQuestionModel. It renders information that is required for all individual prompts (such as name, meaning and instructions).