Sometimes we need to know the metrics that are using ApplySimple/ApplyAGG in our projects and it is hard to get this list using MicroStrategy Developer.

Today, I’ll teach you how to get that list using Command Manager and Alteryx.

 

Click Here to download the metrics

 

Here are the steps:

  1. Connect to your project source using Command Manager;

  2. Create a new Procedure using File -> New Procedure;

  3. Paste this code in the Code Editor tab:

 

DisplayPropertyEnum iProperty = DisplayPropertyEnum.EXPRESSION;

 

// Retrieve all attributes in the project

ResultSet oAttributes = executeCapture(“LIST ALL METRICS ” + “FOR PROJECT ‘” + projectName + “‘ ;”);

ResultSet oPropertySet = null;

oAttributes.moveFirst();

while (!oAttributes.isEof()) {

    String sAttributeName = oAttributes.getFieldValueString(DisplayPropertyEnum.NAME);

    String sAttributePath = oAttributes.getFieldValueString(DisplayPropertyEnum.PATH);

if(sAttributeName.length() >0) {

if(sAttributePath.length()>0){

try {

    oPropertySet = executeCapture(“LIST PROPERTIES FOR METRIC ‘” + sAttributeName + “‘ IN FOLDER ‘” + sAttributePath + “‘ FOR PROJECT ‘” + projectName + “‘;”);

    oPropertySet.moveFirst();

    if (oPropertySet != null) {

        // print out expressions

                printOut(“MetricName : ‘” + oPropertySet.getFieldValueString(DisplayPropertyEnum.NAME) + “‘” + “^” + “Expression : ” + oPropertySet.getFieldValueString(DisplayPropertyEnum.EXPRESSION));

        }

}catch(Exception e){e.printStackTrace();}

}

}

        oAttributes.moveNext();

}

4. Now, create under propertiescreate a new input as projectName with a type of String:

 

5.Click on Test Informationand under Inputs for Execution, type in your project nameand click Connect:

6.Click on the Lightning button to execute your procedure:

7.From the Messages tab, copy everything to an excel file and just remove the lines that are not related to your metrics. Your excel should looks like this:

8.Now, use the workflow to see all your ApplySimple functions. You can also change the filter to show ApplyAgg or any other function or field: