Hi Guys
PFB the code i have written to get the color of the object
var aObjDefs = oModel.ObjDefList();
for (var j = 0; j < aObjDefs.length; j++) {
var oObjDef = aObjDefs[i];
var ObjColor=aObjDefs[i].getFillColor;
getFillColor doesnt return anything.Could you please tell me how to get the color of the object in
ARIS Report script.
Thanks and Regards
Manojna Kadiri
Hi Jens
Thanks for your reply.
If I have to compare the output of the function getFillColor to a color how do i do it.
for eg:
var ObjColor=oObjOcc.getFillColor;
if (ObjColor==Constants.C_BLACK)
{
var k = k+1;
}
This doesnt seem to be working.Could you please tell me how to go about it
Thanks and Regards
Manojna Kadiri
Hi Manojna
First of all when you check for the fill color you declare k as a new variable, this might override your counts, also getFillColor should have () at the end, try this and see if it works:
var k =0;
..........
var ObjColor=oObjOcc.getFillColor();
if (ObjColor==Constants.C_BLACK)
{
k = k+1; // you can increment by using the following command as well: k++;
}
Ciska
Thanks a lot Ciska
It worked!!!!
I have one more question.How do i get the name of the object pertaining to a particular color.
See my code below and suggest for any changes
for (var j = 0; j < aObjOcc.length; j++) {
var oObjDef = aObjDef[j];
var oObjName=aObjDef[j].Name(nLocale);
var oObjOcc = aObjOcc[j];
var ObjColor=oObjOcc.getFillColor();
if(ObjColor==Constants.C_BLACK)
{
k++;
oOutput.OutputLn(oObjname, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 10);
}
But the above one doesnt give me the correct output.I want the name of the object at that condition when the color equals black becomes true
Thanks
Manojna Kadiri
Hi Manojna
for(var j=0; j<aObjOcc.length; j++) {
var oObjOcc = aObjOcc[j];
var ObjColor = oObjOcc.getFillColor();
if(ObjColor==Constants.C_BLACK) {
k++;
oOutput.OutputLn(oObjOcc[j].getObjDefName(nLocale), "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 10);
}
}
It seems like you are getting confused with the for loop and j which belongs to that specific for loop, e.g var oObjDef = aObjDef[j]; In the for loop you are working through aObjOcc and not aObjDef. If you want to use the object definition of the object occurrence you refer to it as var oObjDef = aOcjOcc[j].ObjDef(); Keep in mind if you have a loop within a loop not to use the same variable - j in this example.
Ciska
Thanks a lot Ciska
It is really helping me a lot as iam new to ARIS scripting and finding it difficult to get the correct methods for my requirement
Could you please tell me which method i need to use in Reports to get the attributes of the object.
I could get the method for getting model attributes but not object attributes.
Thanks once again
Manojna Kadiri
Hi Manojna
Getting the attributes of an object depends on the list you are working with.
If you use Object occurrences then the attribute will be referenced as:
ObjOcc.ObjDef().Attribute(Constants.AT_DESC,g_nloc).GetValue(true)
where Constants.AT_XXX refer to the standard attributes in aris. you will find that API name in the configuration.
If you are wokring with the defintion itself then the command will be:
Object.Attribute(Constants.AT_DESC,g_nloc).GetValue(true)
Object or ObjOcc will be the variable name you give.
Userdefined attribute is always best to declare them as a global variable in order to reference them via a variable name you give, if you will be using it more than once in the script. To decare a custom attribute:
var iCtrlClass = ArisData.ActiveFilter().UserDefinedAttributeTypeNum("GUID of the attribute");
and you can refer to this attribute
Object.Attribute(iCtrlClass,g_nloc).GetValue(true)
So in nutshell when using Object Occurrences
var g_nloc = Context.getSelectedLanguage();
var oObjOcc = ArisData.getSelectedModels()[0].ObjOccList();
for(var i=0; i<oObjOcc.length; i++){
oOutput.OutputLn(oObjOcc[i].ObjDef().Name(g_nloc), "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 10);
oOutput.OutputLn(oObjOcc[i].ObjDef().Attribute(Constants.AT_DESC, g_nloc).GetValue(true), "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 10);
}
When using the definition
var g_nloc = Context.getSelectedLanguage();
var oObjDefs = ArisData.getSelectedModels()[0].ObjDefList();
for(var i=0; i<oObjDefs.length; i++){
oOutput.OutputLn(oObjDefs[i].Name(g_nloc), "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 10);
oOutput.OutputLn(oObjDefs[i].Attribute(Constants.AT_DESC, g_nloc).GetValue(true), "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 10);
}
Hope it helps
Ciska
Hi Ciska
Thnaks a lot.I just wanted to know where can i get the help for various connection types available in ARIS.
Eg:I want to know what does "technically superior" actually mean.I dont find any help on the connection types available in ARIS.
The above relation holds good between Organisational units and Peron types etc...
I wanted to get the explanation of each connecting type to use them properly in the models.
Thanks and Regards
Manojna Kadiri
Hi,
Connection types are limited to the from and to objects. If you want more information about relationships, in ARIS, go to Help, Method help or in your ARIS installation directory or CD you will find a PDF file that contains explantion of objects, models, connection types, allowed connection types between objects and so forth.
Ciska
Hi Ciska
Thanks a lot
I have one more question for you.
Can you tell me how can i get a list of sourceObjects for a particular target object in a report.
I mean i want the list of objects having a relation to a particular target object in a model.
In short how do i check if a particular relation exists between 2 objects ?Is there any method to check the same
The scenario is
Keeping the target Obj constant and looping over the sourceobjects i want to get the count of source objects that has a "belongs to" relation with the target Obj in a given model.
Thanks and Regards
Manojna kadiri