MicroStrategy ONE

Passing Value and Object Prompt Answers in the URL

Sometimes you want to pass the answer to one or more prompts in the request so that the report or document is executed automatically, without requiring the user to enter information. In this scenario, you will pass answers to both value prompts and object prompts in the URL.

Unlike element prompt answers, value and object prompt answers do not have an identifier. As a result, the order of the prompt answers in the prompt answer parameter is very important. Value and object prompts are answered in the order in which they are specified in the URL parameter.

Passing Value Prompt Answers in the URL

The valuePromptAnswers parameter is used to answer value prompts through the URL. This parameter can provide a single value prompt answer, or it can provide multiple value prompt answers by separating the prompt answers with a caret character ("^"). The URL parameter to answer value prompts should appear in the format below:

valuePromptAnswers=<prompt answer 1>^<prompt answer 2>^...^<prompt answer n>

where <prompt answer> is a string value.

Value prompts are answered in the order in which they are specified in the URL. If you want to leave a prompt unanswered, you use a "^" (caret) delimiter character by itself to signify the unfurnished prompt answer. At runtime, the user is prompted for any unfurnished prompt answers.

When a "^" (caret) delimiter character is used by itself, it represents an unanswered prompt and not an empty prompt answer. Currently, you cannot provide an empty prompt answer via the URL, so the user will be prompted with any unanswered prompt at run-time even if it was an optional prompt.

The “Sales by Year and Region" report includes two value prompts, one for Region and one for Date. In this scenario, you will use three different URLs to execute this report— to illustrate being prompted for both answers, being prompted for one answer, and not being prompted:

  1. Using a URL that includes no answers for value prompts 

  2. Using a URL that includes only one value prompt answer 

  3. Using a URL that includes multiple value prompt answers

The “Sales by Year and Region” report is located MicroStrategy Tutorial -> Shared Reports -> MicroStrategy Platform Capabilities -> MicroStrategy SDK -> Customization Scenarios -> URL API for Prompts -> Value Prompts. The ID for this report is 8F4C37FF40D632402F6F048817A8AEC9.

A detailed explanation for each URL is provided below.

  1. Using a URL that includes no answers for value prompts:

    Use the following URL to execute the “Sales by Year and Region” report without passing any prompt answers in a URL parameter::

    J2EE environment:


    http://webserver/MicroStrategy/servlet/mstrWeb?evt=4001&src=mstrWeb.4001&reportViewMode=1&reportID=8F4C37FF40D632402F6F048817A8AEC9

    .NET environment:


    http://webserver/MicroStrategy/asp/Main.aspx?evt=4001&src=Main.aspx.4001&reportViewMode=1&reportID=8F4C37FF40D632402F6F048817A8AEC9

    When this request is submitted to MicroStrategy Web, the prompt page is displayed, asking the use to select a Region and Date.



    Once the values are selected, the report is run. Assuming that you select "Northeast" as the answer to the first prompt (Region) and "1/1/2004" as the answer to the second prompt (Date), the executed report should look like the one shown below.

  2. Using a URL that includes only one value prompt answer:

    If you want to supply a prompt answer only for the Region prompt but not for the Date prompt, use the following URL to execute the “Sales by Year and Region” report, passing the answer to the first prompt (Region) in the URL:

    J2EE environment:


    http://webserver/MicroStrategy/servlet/mstrWeb?evt=4001&src=mstrWeb.4001&reportViewMode=1&reportID=8F4C37FF40D632402F6F048817A8AEC9&valuePromptAnswers=Northwest

    .NET environment:


    http://webserver/MicroStrategy/asp/Main.aspx?evt=4001&src=Main.aspx.4001&reportViewMode=1&reportID=8F4C37FF40D632402F6F048817A8AEC9&valuePromptAnswers=Northwest

    In this request, you set the answer to the Region prompt to "Northwest" by appending the URL parameter shown below

    valuePromptAnswers=Northwest

    When this request is submitted to MicroStrategy Web, the prompt page is displayed. Since the Region prompt answer (Northwest) was passed in the URL, the prompt page asks the user to select only a Date.

    Once you select the value for the Date prompt, the report is run. Assuming that you choose "1/1/2004" as the Date value, the report should look like the one shown below. 

    If you want to supply a prompt answer only for the Date prompt but not for the Region prompt, use the following URL to execute the “Sales by Year and Region” report, passing a "^" (caret) delimiter character to signify the unfurnished first prompt answer and the actual answer to the second prompt (Date) in the URL:

    J2EE environment:


    http://webserver/MicroStrategy/servlet/mstrWeb?evt=4001&src=mstrWeb.4001&reportViewMode=1&reportID=8F4C37FF40D632402F6F048817A8AEC9&valuePromptAnswers=^1/1/2005

    .NET environment:


    http://webserver/MicroStrategy/asp/Main.aspx?evt=4001&src=Main.aspx.4001&reportViewMode=1&reportID=8F4C37FF40D632402F6F048817A8AEC9&valuePromptAnswers=^1/1/2005

    In this request, you set the answer to the Date prompt to "1/1/2005" by appending the URL parameter shown below:

    valuePromptAnswers=^1/1/2005

    When this request is submitted to MicroStrategy Web, the prompt page is displayed. Since the Date prompt answer (1/1/2005) was passed in the URL, the prompt page asks the user to select only a Region.

    The "^" (caret) delimiter character used in place of the Date represents an unanswered prompt and not an empty prompt. You cannot provide an empty value prompt in the URL.

  3. Using a URL that includes multiple value prompt answers:

    Multiple prompt answers are applicable only to top-level prompts; not nested prompts.

    Use the following URL to execute the “Sales by Year and Region” report, passing the answers to both prompts (Region and Date) in the URL:

    J2EE environment:


    http://webserver/MicroStrategy/servlet/mstrWeb?evt=4001&src=mstrWeb.4001&reportViewMode=1&reportID=8F4C37FF40D632402F6F048817A8AEC9&valuePromptAnswers=South^1/1/2005

    .NET environment:


    http://webserver/MicroStrategy/asp/Main.aspx?evt=4001&src=Main.aspx.4001&reportViewMode=1&reportID=8F4C37FF40D632402F6F048817A8AEC9&valuePromptAnswers=South^1/1/2005

    In this request, you set the answer to the first prompt (Region) to "South" and the answer to the second prompt (Date) to "1/1/2005", by appending the URL parameter shown below

    valuePromptAnswers=South^1/1/2005 

    When this request is submitted to MicroStrategy Web, the report is run automatically, prompts are answered without displaying the prompt page, and the report filter displays the prompt answers passed in the URL. The report should look like the one shown below.

Passing Object Prompt Answers in the URL

The objectsPromptAnswers parameter is used to answer object prompts through the URL. Each object prompt answer consists of the objectID, the object type, and the object name, separated by "~" characters. This parameter can provide a single object prompt answer, or multiple object prompt answers by separating the individual prompt answers (that is, the set of  objectID, object type, and object name) with a caret character ("^"). The URL parameter to answer object prompts has the format shown below:

objectsPromptAnswers=[objectID1]~[type1]~[name1]^[objectID2]~[type2]~[name2]^...^[objectIDn]~[typen]~[namen]

 
Parameter ValueDescription

objectID

The ID of the element in the data warehouse

type

The object type, such as "4" for metric or "12" for attribute

name

The display name of the object

The “Sales by Quarter” report includes two object prompts, one for attributes and one for metrics. You can specify one or more values for each of these prompts. In this scenario, you will use two different URLs to execute this report:

  1. Using a URL with one object per prompt answer 

  2. Using a URL with multiple objects per prompt answer

The “Sales by Quarter” report is located MicroStrategy Tutorial -> Shared Reports -> MicroStrategy Platform Capabilities -> MicroStrategy SDK -> Customization Scenarios -> URL API for Prompts -> Object Prompts. The ID for this report is 1A0E36AA42A062734A8CB2BE28EFB2C8.

A detailed explanation for each URL is provided below.

  1. Using a URL with one object per prompt answer:

    Use the following URL to execute the “Sales by Quarter” report, passing only one object (Category) as the answer to the first prompt (Attribute) and only one object as the answer (Revenue) to the second prompt (Metric), in a URL parameter::

    J2EE environment:


    http://webserver/MicroStrategy/servlet/mstrWeb?evt=4001&src=mstrWeb.4001&reportViewMode=1&reportID=1A0E36AA42A062734A8CB2BE28EFB2C8&objectsPromptAnswers=8D679D3711D3E4981000E787EC6DE8A4~12~Category^4C05177011D3E877C000B3B2D86C964F~4~Revenue

    .NET environment:


    http://webserver/MicroStrategy/asp/Main.aspx?evt=4001&src=Main.aspx.4001&reportViewMode=1&reportID=1A0E36AA42A062734A8CB2BE28EFB2C8&objectsPromptAnswers=8D679D3711D3E4981000E787EC6DE8A4~12~Category^4C05177011D3E877C000B3B2D86C964F~4~Revenue

    In this request, you set the answer to the Attribute prompt to "Category" and the Metric prompt to "Revenue" by appending the URL parameter shown below:

    objectsPromptAnswers=8D679D3711D3E4981000E787EC6DE8A4~12~Category^4C05177011D3E877C000B3B2D86C964F~4~Revenue 

    When this request is submitted to MicroStrategy Web, the prompt page is not displayed since the Metric prompt answer (Revenue)and the Attribute prompt answer (Category) are both passed in the URL. The prompt page is skipped and the report is executed with the specified attribute and metric.

  2. Using a URL with multiple objects per prompt answer:

    Multiple prompt answers are applicable only to top-level prompts; not nested prompts.

    Use the following URL to execute the “Sales by Quarter” report, passing only one object (Category) as the answer to the first prompt (Attribute) and two objects as the answer (Profit and Revenue) to the second prompt (Metric), in a URL parameter:

    J2EE environment:


    http://webserver/MicroStrategy/servlet/mstrWeb?evt=4001&src=mstrWeb.4001&reportViewMode=1&reportID=1A0E36AA42A062734A8CB2BE28EFB2C8&objectsPromptAnswers=8D679D3711D3E4981000E787EC6DE8A4~12~Category^4C051DB611D3E877C000B3B2D86C964F~4~Profit%1B4C05177011D3E877C000B3B2D86C964F~4~Revenue

    .NET environment:


    http://webserver/MicroStrategy/asp/Main.aspx?evt=4001&src=Main.aspx.4001&reportViewMode=1&reportID=1A0E36AA42A062734A8CB2BE28EFB2C8&objectsPromptAnswers=8D679D3711D3E4981000E787EC6DE8A4~12~Category^4C051DB611D3E877C000B3B2D86C964F~4~Profit%1B4C05177011D3E877C000B3B2D86C964F~4~Revenue

    In this request, you set the answer to the first (attribute) prompt to Categoryand the second (metric) prompt to both Profit and Revenue, by appending the URL parameter shown below:

    objectsPromptAnswers=8D679D3711D3E4981000E787EC6DE8A4~12~Category^4C051DB611D3E877C000B3B2D86C964F~4~Profit%1B4C05177011D3E877C000B3B2D86C964F~4~Revenue
     

     “%1B” is used as a separator when one prompt is answered with multiple objects.

    When this request is submitted to MicroStrategy Web, the prompt page is not displayed since the metric prompt answer (Profit and Revenue) and the attribute prompt answer (Category) are both passed in the URL. The prompt page is skipped and the report is executed with the specified attribute and metrics.