Hi All,
I am new in ARIS scripting.
Please help me on this report...I need script for below ,
Report should show all group names and last user of selected model.like if I have same model in different group then report all the group names which have same model.
I hope i will get good response from Aris Community .
Thanks in Advance.
Hello,
oModelList = ArisData.getSelectedModels();
for (i = 0; i < oModelList.length; i++){
oModel = oModelList;
// output the name, group and last user...
sValue = oModel.Name(g_nLoc);
sValue = oModel.Group().Path(g_nLoc);
sValue = oModel.Attribute(Constants.AT_LUSER, g_nLoc).getValue()
}
Well, that is the basic - you will have to define the output object and output the three sValues to either cells in a table or lines in a word file...
Otherwise I would strongly recommend to have a look at the scripting examples provided in this forum.
Hi Robert Goldenbaum,
I need script for below,
Eg: In ABC Database had two groups,
1: Group1 , In this had two groups,
a : subGroup1, inside this had model "xyzmodel".
b : subGroup2, inside this had another model "pqrmodel".
2:Group2, Had a sub group,
subGroup4, inside this had "xyzmodel".
Now we need report of both parents group names which have "xyzmodel" in database. like ex: "Group1 and Group2".
var oModelList = ArisData.getSelectedModels();
for (i = 0; i < oModelList.length; i++){
oModel = oModelList;
// output the name, group and last user...
var sValue1 = oModel.Name(g_nLoc);
var sValue2 = oModel.Group().Name(g_nLoc);
var sValue3 = oModel.Attribute(Constants.AT_LUSER, g_nLoc).getValue()
oOutput.OutputLn("sValue1: " + sValue1, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 10);
oOutput.OutputLn("sValue2: " + sValue2, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 10);
oOutput.OutputLn("sValue3: " + sValue3, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 10);
}
This script is giving sub group name.
Ex: sValue2 - subGroup1.// given only one group name.
Well, you could also do it like this:
oSelGroupList = ArisData.getSelectedGroups();
for (i = 0; i < oSelGroupList.length; i++){
oGroup = oSelGroupList[i];
oModelList = oGroup.ModelList(true);
// iterate through the model list
}
So you would have a list of all models below the one parent group and a list of all models below the other one...
Dear Robert,
I tried the sort function as u said. But its not getting sorted. I am really clueless. Below is my code. Can u plz have a look.
Code Sample
for(var i=0; i<p_aGroup.length; i++)
{
var oModels = p_aGroup[i].ModelList();
var grp=p_aGroup[i];
subGroups.push(grp);
subGroups = subGroups.concat(grp.Childs(false));
}
for(var i=0; i<subGroups.length; i++) {
var subModels = subGroups[i].ModelList()
subModels = ArisData.sort(subModels, Constants.SORT_GROUPHIERARCHY,nLocale);
for(var j=0; j<subModels.length; j++)
{
p_output.BeginSection(297.2, 420.3, 28.34467120181406, 28.34467120181406, 30, 30, 20, 20, false, Constants.SECTION_DEFAULT)
sectionPageSetup( p_output )
p_output.BeginParagraph( Constants.FMT_LEFT, 0, 0, 0, 0, 0)
writeData5(p_output, subModels[j].Name(nLocale))
p_output.EndParagraph()
writeData3(p_output, subModels[j].Graphic(true, false, nLocale, false))
var oobjocc = subModels[j].ObjOccList();
for(var a=0;a<oobjocc.length;a++){
if(oobjocc[a].SymbolName()=="Value-added chain")
{
if(oobjocc[a].ObjDef().AttrList(nLocale, [Constants.AT_DESC])!="")
{
p_output.OutputLn("", getString("ID_REPORTDEF_12"), 14, RGB(0,0,0), Constants.C_TRANSPARENT,Constants.FMT_LEFT, 0)
writeData(p_output, oobjocc[a].getObjDefName(nLocale))
p_output.OutputLn(" ", getString("ID_REPORTDEF_12"), 14, RGB(0,0,0), Constants.C_TRANSPARENT,Constants.FMT_LEFT, 0)
p_output.OutputLn(getString("ID_REPORTDEF_3"), getString("ID_REPORTDEF_12"), 14, RGB(0,0,0), Constants.C_TRANSPARENT,Constants.FMT_LEFT, 20)
iteration_group1(p_output, oobjocc[a].ObjDef().AttrList(nLocale, [Constants.AT_DESC]))
}}}
var ocurrentgroup = subGroups[i];
var ochildren = ocurrentgroup.Childs(true);
for(var p=0; p<ochildren.length; p++)
{
var smallModels = ochildren[p].ModelList();
smallModels = ArisData.sort(smallModels,Constants.SORT_GROUPHIERARCHY,nLocale);
for(var q=0; q<smallModels.length; q++)
{
p_output.BeginSection(297.2, 420.3, 28.34467120181406, 28.34467120181406, 30, 30, 20, 20, false, Constants.SECTION_DEFAULT)
sectionPageSetup( p_output )
p_output.BeginParagraph( Constants.FMT_LEFT, 0, 0, 0, 0, 0)
writeData5(p_output, smallModels[q].Name(nLocale))
p_output.EndParagraph()
writeData3(p_output, smallModels[q].Graphic(true, false, nLocale, false))
var oobjoccchild = smallModels[q].ObjOccList();
for(var b=0;b<oobjoccchild.length;b++)
{
if(oobjoccchild[b].SymbolName()=="Process step")
{
if(oobjoccchild[b].ObjDef().AttrList(nLocale, [Constants.AT_DESC])!="")
{
p_output.OutputLn("", getString("ID_REPORTDEF_12"), 14, RGB(0,0,0), Constants.C_TRANSPARENT,Constants.FMT_LEFT, 0)
writeData(p_output, oobjoccchild[b].getObjDefName(nLocale))
p_output.OutputLn(" ", getString("ID_REPORTDEF_12"), 14, RGB(0,0,0), Constants.C_TRANSPARENT,Constants.FMT_LEFT, 0)
p_output.OutputLn(getString("ID_REPORTDEF_3"), getString("ID_REPORTDEF_12"), 14, RGB(0,0,0), Constants.C_TRANSPARENT,Constants.FMT_LEFT, 0)
iteration_group1(p_output, oobjoccchild[b].ObjDef().AttrList(nLocale, [Constants.AT_DESC]))
}
}
}
}
}
}
}
Note :
I am able to print all the Models inside groups with above code. But the hierarchy is not correct. This is my current obsession with ARIS script.
Hm well, you only get the models of a single group and then sort them via their group hierarchy - which is the same for every model of the same group.
I thought you would be doing something like this:
oModelList = oStartGroup.ModelList(true)
oModelList = ArisData.sort(oModelList, Constants.SORT_GROUPHIERARCHY, 1033)
...
Well... your request is to export data based on the model, but you have to understand that there is only 1 model in each database. You can have more models with the same name, but they are different objects.
The simplest thing to do is the following:
1. get all the models into 1 array like Rober suggested.
2. sort it alphabetically by its name.
3. loop through the array while checking if there is more than 1 model in database / groups.
Martin
Maybe i should rephrase my question. I have a model in a group A . There is another model in Group B. These models are not related or connected in any way. But what i need is to run a report on model in group A. But i need to print the model from group B as well in that same report. I dont't know if this possible?
I tried to simply print the model graphic by the name of model as below. But this is also not happening somehow.
writeData3(p_output,(FSS SLA map).Graphic(true, false, nLocale, false))
Ahm well, that depends on how you want to find this "other" model... You could go from the group of the start model to the parent group and then to the "other" group of the "other" model and get it like this...
But well, this seems like not such a good approach...
Hm well, there is the database method "Find" - there you can add the needed parameters etc.
The search can help :-)
And ArisData.getSelectedModels() only returns the models where you have started the script on... Once again - use the search and also have a look into other standard scripts...
I tried with the code below. But it prints Undefined. Appreciate any help. I am going crazy with this
var nLocale = Context.getSelectedLanguage();
var output = Context.createOutputObject();
var db = ArisData.getActiveDatabase();
var models = db.Find(Constants.SEARCH_MODEL);
for(var i = 0; i < models.length; i++)
{
if(models[i]== "Develop Vision and Strategy")
{
var pic = models[i].Graphic(false, false,nLocale);
}
}
output.OutputLn("Model "+ pic, "Arial", 15, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 10);
output.WriteReport();