EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB11113: How to use prompts to return attribute element values within an Apply statement in MicroStrategy Developer and Web


Stefan Zepeda

Salesforce Solutions Architect • Strategy


When using any of the Apply statements in conjunction with prompts used to select attribute element values, it is necessary that a value be returned as an argument into the function of the statement.

When using any of the Apply statements in conjunction with prompts used to select attribute element values, it is necessary that a value be returned as an argument into the function of the statement.
 
The following sections explain how each type of prompt may be used within an Apply statement:
 
Level prompts:
As level prompts are only designed to define the level at which a metric is calculated, they cannot be used within Apply statements.
 
Object prompts:
Object prompts may be used to select attributes. They can be used in Apply statements to select which attribute(s) to filter on, but they cannot be used to return attribute element values.
 
Filter prompts:
Filter prompts provide users with the option to select from an attribute element list, but they cannot be used because a single value is not returned from the prompt. The value returned from the prompt will always be in the form of "<attribute> in (<list of selected attribute elements>)."
 
For example, a filter prompt is used on an attribute element list within the report filter within the following report definition:

ka02R000000kZibQAE_0EM440000002FoK.jpeg

 
The prompt answer is then defined as follows:
 

ka02R000000kZibQAE_0EM440000002FoM.jpeg

 
The following SQL is returned:
 
select a11. AS ITEM_ID,
max(a12.) AS ITEM_NAME,
sum(a11.) AS WJXBFS1
from a11,
a12
where a11. = a12.
and a11. between a11. in (200306) and 200312
group by a11.
Because Apply statements are run directly against the warehouse database, an error will be returned when the report is executed. The database will not know how to interpret the value returned from the filter prompt, nor can the prompt answer be parsed prior to it being executed by the database.
 
Value prompts:
Currently, the only prompt that will return a single value is a Value prompt, and, therefore, is the only prompt that should be used within an Apply statement.
 
If the above report is redefined to use a value prompt in place of the filter prompt as follows:
 

ka02R000000kZibQAE_0EM440000002FoB.jpeg

 
and the prompt answer is defined as follows:
 

ka02R000000kZibQAE_0EM440000002FoD.jpeg

 
the following SQL will be returned:
 
select a11. AS ITEM_ID,
max(a12.) AS ITEM_NAME,
sum(a11.) AS WJXBFS1
from a11,
a12
where a11. = a12.
and a11. between 200306 and 200312
group by a11.
As this prompt returns the value entered by the user directly, the correct SQL will be generated and the report should execute properly.
 


Comment

0 comments

Details

Knowledge Article

Published:

June 8, 2017

Last Updated:

June 8, 2017