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

KB15865: How to use single and double quotes inside of the quoted Applysimple statement when creating a metric with MicroStrategy Command Manager.


Community Admin

• Strategy


How to use single and double quotes inside of the quoted Applysimple statement when creating a metric with MicroStrategy Administrator - Command Manager.

Users wish to execute scripts in Strategy Command Manager that require single quotes in the definition. For example, the following will illustrate how to create a metric with a constant element inside the Applysimple statement:
 
CREATE METRIC 'Test' IN FOLDER '\Profiles\Administrator\My Objects' EXPRESSION "Sum(ApplySimple("decode(upper(trim(#0)),'CONSTANT ELEMENT',#1)", @DESC, Country@DESC)) {~}" ON PROJECT 'Strategy Tutorial';
Normally, this script will fail with the following error message:
 

ka0PW0000000zmfYAA_0EM440000002BW4.jpeg

 
Invalid construction of a statement.
The expression parser fails to validate the syntax because the inner string uses the same quote marks (double quote) as the outer string, as shown below:
 
"Sum(ApplySimple("decode(upper(trim(#0)),'CONSTANT ELEMENT',#1)", @DESC, Country@DESC)) {~}"
There are two ways to correct the syntax:
 

  1. To pass the expression parser, different quote marks should be used for the inner string. In this example, single quotes should be used for the inner string:
    EXPRESSION "Sum(ApplySimple('decode(upper(trim(#0)),'CONSTANT ELEMENT',#1)', @DESC, Country@DESC)) {~}"
  2. If the same quote marks must be used for the inner string, they need to be enclosed by the ‘^’ character, as shown below:
    EXPRESSION "Sum(ApplySimple(^"decode(upper(trim(#0)),'CONSTANT ELEMENT',#1)^", @DESC, Country@DESC)) {~}"

Comment

0 comments

Details

Knowledge Article

Published:

May 27, 2017

Last Updated:

February 27, 2024