Hi Selim,
if I understand you correctly, it should not be so difficult to solve the problem.
First you need all connections in a model:
var oCxnOccs = oModel.CxnOccList(); //for example all connections in a model
Then you iterate over the array of connections to find out what is the source and the target of every connection:
for(var j=0; j<oCxnOccs.length;j++){ var oCxnOcc = oCxnOccs[j]; var oSourceObjOcc = oCxnOcc.SourceObjOcc(); var sourcetype = oSourceObjOcc.ObjDef().Type(); // get type of source object var nSource = oSourceObjOcc.ObjDef().Name(nLocale); // get name of source object var nCxn = oCxnOcc.Cxn().Name(nLocale); // get name of connection var oTargetObjOcc = oCxnOcc.TargetObjOcc(); var targettype = oTargetObjOcc.ObjDef().Type(); // get type of target object var nTarget = oTargetObjOcc.ObjDef().Name(nLocale); // get type of target object }
Now that you have all the required information you just need the output of it =).
For example:
var oOutputFile = Context.createOutputObject(); // Output object var nLocale = Context.getSelectedLanguage(); // Selected database language var aModels = ArisData.getSelectedModels(); // Array of selected models for (var i = 0; i < aModels.length; i++) { var oModel = aModels[i]; // Current model var sModelName = oModel.Name(nLocale); // Name of current model var oCxnOccs = oModel.CxnOccList(); //for example all connections in a model oOutputFile.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); //table header oOutputFile.TableRow(); oOutputFile.TableCell("ModelName", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); oOutputFile.TableCell("SourceType", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); oOutputFile.TableCell("SourceName", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); oOutputFile.TableCell("ConnectionName", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); oOutputFile.TableCell("TargetType", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); oOutputFile.TableCell("TargetName", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); for(var j=0; j<oCxnOccs.length;j++){ var oCxnOcc = oCxnOccs[j]; oOutputFile.TableRow(); oOutputFile.TableCell(sModelName, 20, getString("TEXT_1"), 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); var oSourceObjOcc = oCxnOcc.SourceObjOcc(); var sourcetype = oSourceObjOcc.ObjDef().Type(); var nSource = oSourceObjOcc.ObjDef().Name(nLocale); oOutputFile.TableCell(sourcetype, 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutputFile.TableCell(nSource, 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); var nCxn = oCxnOcc.Cxn().Name(nLocale); oOutputFile.TableCell(nCxn, 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); var oTargetObjOcc = oCxnOcc.TargetObjOcc(); var targettype = oTargetObjOcc.ObjDef().Type(); var nTarget = oTargetObjOcc.ObjDef().Name(nLocale); oOutputFile.TableCell(nTarget, 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutputFile.TableCell(targettype, 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); } } oOutputFile.EndTable("", 100, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutputFile.WriteReport();
I hope this helps you, I have not tested it very extensively, but it should work:)..
Regards
Eva
Thanks Eva,
First of all, I would like to thank you for your interest. It works fine but i have no idea about script. I have added and run :)
I need this solution as Group-based. Your solution was Model-based. I will run this report group by group (included 30-40 epc models).
Hi Selim,
If I understood true you want to obtaine report for group models not just one model.
Try to select the models via "explorer module" (you can't run group attributes with designer module) and push F8 button. With this way you can get a table for selection model attributes.
I hope this helps you..
Hi Selim,
You must change the source in the following way.
First you need all selected groups:
var aGroups = ArisData.getSelectedGroups();
Then you iterate over the array of selected groups to find out which models are in the group:
var oOutputFile = Context.createOutputObject(); // Output object var nLocale = Context.getSelectedLanguage(); // Selected database language var aGroups = ArisData.getSelectedGroups(); for (var l=0;l<aGroups.length;l++){ var aModels = aGroups[l].ModelList(); // Array of selected models for (var i = 0; i < aModels.length; i++) { oOutputFile.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); var oModel = aModels[i]; // Current model var sModelName = oModel.Name(nLocale); // Name of current model var oCxnOccs = oModel.CxnOccList(); //for example all connections in a model //table header oOutputFile.TableRow(); oOutputFile.TableCell("ModelName", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); oOutputFile.TableCell("SourceType", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); oOutputFile.TableCell("SourceName", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); oOutputFile.TableCell("ConnectionName", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); oOutputFile.TableCell("TargetType", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); oOutputFile.TableCell("TargetName", 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VTOP, 0); for(var j=0; j<oCxnOccs.length;j++){ var oCxnOcc = oCxnOccs[j]; oOutputFile.TableRow(); oOutputFile.TableCell(sModelName, 20, getString("TEXT_1"), 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); var oSourceObjOcc = oCxnOcc.SourceObjOcc(); var sourcetype = oSourceObjOcc.ObjDef().Type(); var nSource = oSourceObjOcc.ObjDef().Name(nLocale); oOutputFile.TableCell(sourcetype, 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutputFile.TableCell(nSource, 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); var nCxn = oCxnOcc.Cxn().Name(nLocale); oOutputFile.TableCell(nCxn, 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); var oTargetObjOcc = oCxnOcc.TargetObjOcc(); var targettype = oTargetObjOcc.ObjDef().Type(); var nTarget = oTargetObjOcc.ObjDef().Name(nLocale); oOutputFile.TableCell(nTarget, 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutputFile.TableCell(targettype, 20, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); } oOutputFile.EndTable("", 100, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); } } oOutputFile.WriteReport();
I hope it works:). The following tutorials will be a good introduction to the world of ARIS scripting.
Regards
Eva