Hello
I created a model matrix.
Created in it column headers and row headers from ObjDef objects (functions and roles) taken from the outFolder folder.
I placed the functions on rows, and placed the roles in columns.
Next, I'm trying to create connections between some functions and roles. Before creating the connection function, I check the contents of the row header and column header with MsgBox. But when calling the
"matrix.createCxn (aHeaderCol [0], aHeaderRow [0], Constants.CT_EXEC_2);"
method, a window with the
"Wrapped java.lang.NullPointerException"
error appears.
Tell me please what I'm doing wrong.
Here is the code:
function main() {
var db = ArisData.getActiveDatabase();
var group = ArisData.getSelectedGroups()[0];
var outFolder = db.Group(["Main_group", "Work folders", "Test", "Matrix", "output_1"], 1049);
var aFuncs = group.ObjDefListFilter ( 22 ); // Functions ObjDefs
var aRoles = group.ObjDefListFilter ( 78 ); // Roles ObjDefs
var oModel = outFolder.CreateModel(220,"Matrix_model",1049);
var matrix = oModel.getMatrixModel();
var Row_matrixHeader = matrix.getHeader(true);
var Column_matrixHeader = matrix.getHeader(false);
var Row_Header_Title = Row_matrixHeader.setTitle("Functions",1049);
var Column_Header_Title = Column_matrixHeader.setTitle("Roles",1049);
// Creating header row cells
for(var i=0; i < aFuncs.length; i++) {
matrix.createHeaderCell(null, aFuncs[i], Constants.ST_FUNC, -1, true);
matrix.setVisibleObjectSymbolTypes([Constants.ST_FUNC], true);
}
// Creating header column cells
for(var i=0; i < aRoles.length; i++) {
matrix.createHeaderCell(null, aRoles[i], Constants.ST_EMPL_TYPE, -1, false);
matrix.setVisibleObjectSymbolTypes([Constants.ST_EMPL_TYPE], false);
}
var aHeaderCol = Column_matrixHeader.getCells();
var aHeaderRow = Row_matrixHeader.getCells();
Dialogs.MsgBox("aHeaderCol[0]: " + aHeaderCol[0].getDefinition().Attribute(Constants.AT_NAME, 1049).getValue()); //OK
Dialogs.MsgBox("aHeaderRow[0]: " + aHeaderRow[0].getDefinition().Attribute(Constants.AT_NAME, 1049).getValue()); //OK
matrix.createCxn( aHeaderCol[0], aHeaderRow[0], Constants.CT_EXEC_2 ); // <- Error
}
main();