Hi All,
Today we are going to see a very handy and programmatic solution oriented tool named MicroStrategy Command Manager(CM). This is one of the coolest features in MicroStrategy where we can script the repetitive tasks and execute in bulk to get the task done!
And it supports scripting of procedures which is nothing but programmatically making the existing scripts to run in a recursive pattern to get the work done...
Let see a very practical example of how to write a Command Manager Procedure to solve a very cumbersome requirement...
So now how do we write a CM procedure to get to a specific requirement. The answer is always in the in the Sample Procedures that are already available in the CM UI like below...
Navigate to the procedures--> Sample Procedure--> Right click on a procedure.
Sample Procedure....
There are lots of sample procedures available and these procedures can be effectively tuned and reused to suit our requirement.
One of my favorite command manager procedure implementation was when we were doing impact analysis for a database migration for our MicroStrategy projects. And the task was to list out all the expressions of Public Objects and Schema Objects. Basically to find out whether any database specific passthrough functions were used in the definition. Initially we got a project documentation and ended up manually getting the object expressions which was very cumbersome!
Then we came up with a command manager procedures to get the list of the expressions of all the public and schema objects and got them in an excel sheet! which really saved hours of impact analysis!
Below is the script which I developed to list out all the expressions of an attribute...
Today we are going to see a very handy and programmatic solution oriented tool named MicroStrategy Command Manager(CM). This is one of the coolest features in MicroStrategy where we can script the repetitive tasks and execute in bulk to get the task done!
And it supports scripting of procedures which is nothing but programmatically making the existing scripts to run in a recursive pattern to get the work done...
Let see a very practical example of how to write a Command Manager Procedure to solve a very cumbersome requirement...
So now how do we write a CM procedure to get to a specific requirement. The answer is always in the in the Sample Procedures that are already available in the CM UI like below...
Navigate to the procedures--> Sample Procedure--> Right click on a procedure.
Sample Procedure....
There are lots of sample procedures available and these procedures can be effectively tuned and reused to suit our requirement.
One of my favorite command manager procedure implementation was when we were doing impact analysis for a database migration for our MicroStrategy projects. And the task was to list out all the expressions of Public Objects and Schema Objects. Basically to find out whether any database specific passthrough functions were used in the definition. Initially we got a project documentation and ended up manually getting the object expressions which was very cumbersome!
Then we came up with a command manager procedures to get the list of the expressions of all the public and schema objects and got them in an excel sheet! which really saved hours of impact analysis!
Below is the script which I developed to list out all the expressions of an attribute...
Command Manager Procedure...
// property to display
DisplayPropertyEnum iProperty = DisplayPropertyEnum.EXPRESSION;
// Retrieve all attributes in the project
ResultSet oAttributes = executeCapture("LIST ALL ATTRIBUTES FOR PROJECT '" + sProjectName + "';");
ResultSet oPropertySet = null;
oAttributes.moveFirst();
while (!oAttributes.isEof()){
String sAttributeName = oAttributes.getFieldValueString(DisplayPropertyEnum.NAME);
String sAttributePath = oAttributes.getFieldValueString(DisplayPropertyEnum.PATH);
oPropertySet = executeCapture("LIST PROPERTIES FOR ATTRIBUTE '" + sAttributeName + "' IN FOLDER '" + sAttributePath + "' FOR PROJECT '" + sProjectName + "';");
oPropertySet.moveFirst();
// print out expressions
printOut("\n");
printOut("Attribute Name : '" + sAttributeName + "'");
printOut("Attribute Path : '" + sAttributePath + "'");
ResultSet oAttributeForms = (ResultSet)oPropertySet.getFieldValue(DisplayPropertyEnum.ATTRIBUTE_FORM);
oAttributeForms.moveFirst();
while(!oAttributeForms.isEof()){
//get expression list for this attribute
ResultSet oExpressions = (ResultSet) oAttributeForms.getFieldValue(DisplayPropertyEnum.ATTRIBUTE_EXPRESSION_LIST);
if(oExpressions != null){
printOut("--------------------------------------------------");
printOut("Attribute Form Name : '" + oAttributeForms.getFieldValueString(DisplayPropertyEnum.ATTRIBUTE_FORM_NAME) + "'");
oExpressions.moveFirst();
while(!oExpressions.isEof()){
printOut("Expression : " + oExpressions.getFieldValueString(0));
oExpressions.moveNext();
}
}
oAttributeForms.moveNext();
}
printOut("\n ======END OF ATTRIBUTE DEFINITION=======");
oAttributes.moveNext();
}
The challenging part of this procedure is to find out the above highlighted keywords as these keywords are MicroStrategy API defined and unless we use these specific keywords its very hard to get the desired output!
It actually took a while for me to figure out how to get these keywords with ease! The below link actually helps you to get these keywords! The solution is available in the command manager help in your local installation and can be access with the below link... or search for "Project source statement syntax" in your CM web help. Assuming the default installation...
file:///C:/Program%20Files%20(x86)/Common%20Files/MicroStrategy/Help/English/CommandManagerUniversal/cmdmgrhelp.htm#html/statement_syntax_reference_guide.htm
Good Luck!
Hi Reginold,
ReplyDeleteIs it possible to create a user procedure to create security filters for multiple users and apply it,create subscriptions for multiple users? Is it possible to get the user values from a file?