//list all metrics in the project 
String sProjectName = "Project1";
String sFactFolder = "\\Schema Objects\\Facts";
String sMetricFolder = "\\Public Objects\\Metrics";
ResultSet oFacts = executeCapture("LIST ALL FACTS IN FOLDER '" + sFactFolder + "' FOR PROJECT '" + sProjectName + "';"); 
oFacts.moveFirst(); 
while (!oFacts.isEof() )
{
//get name and path of this metric to list properties
String sFactName = oFacts.getFieldValueString(DisplayPropertyEnum.NAME); 
//get properties of each metric
execute("CREATE METRIC \"" + sFactName + "\" IN FOLDER \"" + sMetricFolder + "\" EXPRESSION 'sum([" + sFactName + "])' ON PROJECT \"" + sProjectName + "\";");
oFacts.moveNext();
} 

Leave a Reply

Your email address will not be published. Required fields are marked *