MicroStrategy ONE

WebPrompt

The WebPrompt interface represents generic information that is common to all prompt types. The WebPrompt interface extends the WebObjectInfo interface.

By virtue of extending the WebObjectInfo interface, the WebPrompt interface supports serializing and loading its definition via the methods defined on the WebObjectInfo interface. Note that it is possible to obtain the WebPrompt interface from the WebObjectSource as well. In the latter case the object represents the definition of a prompt object in the metadata repository. The no argument populate method on the WebObjectInfo interface is used to load the object definition from the metadata repository. If the WebPrompt interface is obtained from a report or a document instance, the no argument populate method calls are ignored. In case the prompt object originates from a source other than MicroStrategy Intelligence Server, the prompt definition XML has information that can be used to populate the WebObjectInfo interface.

There are five basic prompt types: (1) Constant, (2) Elements, (3) Expression, (4) Objects, and (5) Dimty (also known as Level prompt). Based on the PromptType property that corresponds to EnumWebPromptType, the WebPrompt interface can be cast into the specific interface:

EnumWebPromptType Specific WebPrompt Interface

WebPromptTypeUnsupported

None

WebPromptTypeConstant

WebConstantPrompt

WebPromptTypeElements

WebElementsPrompt

WebPromptTypeExpression

WebExpressionPrompt

WebPromptTypeObjects

WebObjectsPrompt

WebPromptTypeDimty

WebDimtyPrompt

Each prompt subclass has a set of methods with the same names but different parameter or return value types used to get and set answers. These methods are getAnswer, getDefaultAnswer, getPreviousAnswer and setAnswer. The type of object that can be specified as an answer to the prompt depends on the prompt type.

EnumWebPromptType Specific WebPrompt Interface

WebPromptTypeUnsupported

None

WebPromptTypeConstant

String

WebPromptTypeElements

WebElements

WebPromptTypeExpression

WebExpression

WebPromptTypeObjects

WebFolder

WebPromptTypeDimty

WebDimty

For all prompt types except for constant prompt, the setAnswer method creates a new copy of the provided object rather than making this object itself an answer object of the prompt. This happens only if the provided object is different from the current answer object. This new object is returned from the method call. This behavior allows modification of a returned answer object without affecting the original object.

The CurrentAnswer is the answer to the prompt, as specified in the prompt definition. The getAnswer method always returns an object. If the prompt definition has an answer, then by default, the prompt answer is initialized with that answer. If there is no answer available, an empty object of proper type is returned. This answer can then be changed. The hasOriginalAnswer property indicates whether the prompt XML returned by the I-Server contained the answer.

The DefaultAnswer is the default answer as specified by the prompt designer. The PreviousAnswer is the previous answer that was provided to answer this prompt. Note that DefaultAnswer and PreviousAnswer are both optional properties. There are corresponding boolean properties such as hasDefaultAnswer and hasPreviousAnswer that indicate whether the prompt object has default or previous answer, respectively.

The getAnswerXML, getShortAnswerXML and PopulateAnswer operations on this interface are similar to those described for the WebPrompts interface. The only distinction is that these operations relate to a specific prompt object rather than a prompt collection.

The PIN property indicates the position of the prompt in the container as defined by Intelligence Server. This property may not reflect the index of WebPrompt in the WebPrompts collection. The following method on the WebPrompts interfaces supports lookup by PIN property:

public WebPrompt findPromptByPIN(int pin);

The resolution of WebPrompts and WebPrompt behave differently based on the Closed and Cancel properties. The WebPrompts provides methods to answer or resolve all prompts in the collection in one call to Intelligence Server, while the WebPrompt interface provides methods to answer or resolve individual prompts. For a given prompt, based on these properties, the answer method behaves as follows:

  • Closed = False and Cancel = False

    The answer method sends the answer in the prompt object to Intelligence Server. If the object does not have any answer, it sends an empty answer to Intelligence Server. If the call is successful, it marks the object as closed.

  • Closed = False and Cancel = True

    The answer method asks Intelligence Server to cancel the prompt. If the call is successful, it marks the object as closed. Note that canceling a prompt is semantically different from answering a prompt with empty answer.

  • Closed = True and Cancel = True or False

    Since the prompt is marked closed, the answer method does not make any call to Intelligence Server.

The Closed and Cancel properties are initialized as specified by Intelligence Server such that these properties can be changed. The prompt can also be marked as closed without a calling answer. If the same prompt is re-initialized from Intelligence Server, it comes back as open.

The Minimum and Maximum properties are optional properties that can be NULL. These properties are used to validate the prompt answer. For example, for objects prompt, the Maximum property can specify the maximum number of objects that can be specified as an answer to the prompt.