MicroStrategy ONE
Retrieving information from ResultSet objects
To incorporate the results of a Command Manager statement into a procedure, use the ExecuteCapture command. This command executes a Command Manager statement and stores the results of a LIST operation in a ResultSet object.
Each row in the ResultSet object contains information about one item from the LIST statement. This information is divided into columns, depending on the specific LIST statement executed.
For example, the LIST ALL SHORTCUTS statement returns a list of all the shortcuts in the specified project. Data about each shortcut is stored in a separate row in the ResultSet. Each row, that is, the information about each individual shortcut, is split into the following columns:
- DSS_OBJECT_TYPE, a number corresponding to the type of object the shortcut points to, of type integer or string
- HIDDEN, whether the shortcut is a hidden object, of type boolean
- NAME, the name of the shortcut, of type string
- PATH, the path to the shortcut, of type string
The intersection of each row and column is a ResultCell. In the example above, the Name for a given shortcut occupies a single ResultCell.
You can access the information in a ResultSet using the methods listed in Java syntax: ResultSet methods and Java syntax: ResultCell methods.
For a detailed list of the ResultSet columns used in each Command Manager LIST statement, see the statement syntax guide for each statement.
-
Some ResultCells, such as the cells in the DSS_OBJECT_TYPE column in the example above, can be treated as either a Java object (such as INTEGER or DATE) or a string, as follows:
- The method resultcell.getValue() returns the Java object. In the case of DSS_OBJECT_TYPE, it returns an integer, such as "1024," that corresponds to a specific MicroStrategy object type.
- The method resultset.getValueString() returns a string corresponding to the numeric value. In the case of DSS_OBJECT_TYPE, it returns a string, such as "Metric," that is the name of the specific MicroStrategy object type that corresponds to the integer value.
- Some statements, such as the LIST ATTRIBUTE PROPERTIES statement, return columns of ResultCells whose type is ResultSet. These ResultSets can be accessed using the ResultSet methods, like any other ResultSet.
You can use the HIDDEN column to list all hidden shortcuts, as in the following sample Java procedure:
ResultSet shortcuts = executeCapture("LIST ALL SHORTCUTS FOR PROJECT \"MicroStrategy Tutorial\";");
if(shortcuts.getRowCount() 0){
shortcuts.moveFirst();
while(!shortcuts.isEof()){
Boolean isHidden = (Boolean)\
if(isHidden){
printOut("Shortcut Name: " +
"\tType Value: " +
"\t Type Number: " + shortcuts.getFieldValue(DSS_OBJECT_TYPE));
}
shortcuts.moveNext();
}
}
Related Topics
Using Java in Command Manager procedures