Hi all,
I am trying to create an Excel Report which would allow me to extract an inventory of models and objects within a folder.
I have created Level 2 and Level 3 Maps, and would like to extract a report that would be able to tell me the hierarchy of model names and corresponding functions and objects that exist within a Level 2 Structure.
Ideally this would be extracted within one excel sheet that would store:
Level 2 Model Name
Level 3 Model Name
Level 3 Functions
Level 3 Objects
Level 3 Risks
Level 3 Roles
Any help would be much appreciated.
Thanks
Natalie
Hi Natalie,
so you want to start on a model on level 2 (case A) or on a group (and report all models on this level + their sub-models on level 3) (case B)?
In case A you create a new report with context "Model". The report is either programmed or created using "design view".
Programming the report, you might start as the following :
var model = ArisData.getSelectedModels()[0]
var nameLevel2 = model.Name(-1)
var functionsofModel = model.ObjDefListFilter(Constants.OT_FUNC)
//get assigned models in next level:
for(var i=0; i<functionsofModel.length;i++)
{
var level3Models = functionsofModel[i].AssignedModels()
for(var j=0; j<level3Models.length; j++)
{
var nameLevel3 = level3Models[j].Name(-1)
//the objects can again be retrieved by calling ObjDefList(the required type) on the level 3 model
//lists can be sorted using ArisData.sort(see help)
}
}
In case (B) you start with
var group = ArisData.getSelectedGroups()[0]
var level2models = group.ModelList()
with this, you continue like in case (A) above.
The Excel output is written by using the standard output object (see help: "Output" object) & selecting "Excel" as the output format of the report. In the script you create a new table for each new sheet that should be contained in your excel file.
var ouput = Context.createOutputObject()
...all your tables here
output.WriteReport()
Hope this helps,
Torsten