I want to generate a report from a folder level or databse level , I know how to generate report from a model and i want to get all roles in this report , which are available in this database. Please give your valuable comments. Thanks
10 Replies
Hi Karthikeyan,
Thanks but its not working, the below mention code is for model and its working fine but i have tried for group its not working showing error. In line 7 .model is a symbol name, what does it mean??
1.function getModelSelection() {
2. var oSelectedModels = ArisData.getSelectedModels();
3. if (oSelectedModels.length == 0) {
4. var oSelectedObjOccs = ArisData.getSelectedObjOccs();
5. if (oSelectedObjOccs.length > 0) {
6. for (var i = 0; i < oSelectedObjOccs.length; i++) {
7. oSelectedModels.push(oSelectedObjOccs[i].Model());
8. }
9. oSelectedModels = ArisData.Unique(oSelectedModels);
10. }
11. }
return oSelectedModels;
}
Hi Anjana,
Try using the below basic code to list all the OU type object from the database.Create a new report with context as "Database" and use the below code,
// Code to list all OU object in database
var oDB = ArisData.getActiveDatabase();
var g_outfile=null;
var g_nloc=Context.getSelectedLanguage();
function main()
{
var objs=oDB.Find(Constants.SEARCH_OBJDEF,43);
var g_ooutfile = Context.createOutputObject();
g_ooutfile.DefineF("REPORT2", getString("TEXT6"), 14, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0, 21, 0, 0, 0, 1);
g_ooutfile.BeginTable(100, Constants.C_GREY_80_PERCENT, - 1, 8, 0);
g_ooutfile.TableRow();
g_ooutfile.TableCell("Name", 15, getString("TEXT1"), 9, 0, getTableCellColor_Head(), 0, 145, 0);
g_ooutfile.TableCell("Type", 15, getString("TEXT1"), 9, 0, getTableCellColor_Head(), 0, 145, 0);
g_ooutfile.TableCell("Group", 15, getString("TEXT1"), 9, 0, getTableCellColor_Head(), 0, 145, 0);
for(var i=0;i<objs.length;i++)
{
g_ooutfile.TableRow();
g_ooutfile.TableCell(objs[i].Name(g_nloc), 15, getString("TEXT1"), 10, 0, Constants.C_WHITE, 0, 136, 0);
g_ooutfile.TableCell(objs[i].Type(), 15, getString("TEXT1"), 10, 0, Constants.C_WHITE, 0, 136, 0);
g_ooutfile.TableCell(objs[i].Group().Path(g_nloc), 15, getString("TEXT1"), 10, 0, Constants.C_WHITE, 0, 136, 0);
}
g_ooutfile.EndTable("", 250, getString("TEXT1"), 12, 0, - 1, 0, 136, 0);
g_ooutfile.WriteReport();
}
main()
Hi Anjana,
Have you tried my last code?. Did it worked. In this same code structure with little modification you can also generate the report at group level .
Hi Karthikeyan,
I have tried your last code, it works fine.
I could not find object type number instead of symbole type number. Do you know how to apply the symbol type number in the code?
Thanks!
Hi Karthikeyan
Thanks a ton for youe help, i did not try your code.. i have done in some other way.
Regards,
Anjana
Hi Jim,
You can find the object type numbet in ARIS in below mentioned folder.
Configration > Method > Symbols
Select one object which one you want, right click on that and go to last options(if its a user defined than you get its GUID).
Thanks
Regards,
Anjana
Thanks Anjana!
I do not think we need GUID in the following code.
var objs=oDB.Find(Constants.SEARCH_OBJDEF,43);
43 should be object type ID, one of our object named "Control" and what I could find is symbol type ID.
Hi Jim,
// var objs=oDB.Find(Constants.SEARCH_OBJDEF,43);
The above code works only for Object Type Num not for Symbol Type Num .
If you want get the object by Symbol Type Num then use the below code,
var objs=oDB.Find(Constants.SEARCH_OBJDEF,<Give Type Num of an Object>);
var obj_symbol=objs[i].ObjDef().getDefaultSymbolNum();
if(obj_symbol==<Give Type Num of Symbol>)
Print the Object
Else
Continue
Hope this will help !!!
karthikeyan balasubramanian on
Hi Anjana,
When creating a new report, Select the context as "Database".
//In code, define the below line globally for running the report on the selected database,
var oDB = ArisData.getActiveDatabase();
//Inside your search function , find the total objects ,array length and print the output,
var objs=oDB.Find(Constants.SEARCH_OBJDEF,43); // 43 is the type num of your search object.
for(var i=0;i<objs.length;i++)
Print the objs[i].Name(g_nloc) for Search object.
Hope this information will help you to design the required database report