IS
Hello!
I try to output some attributs from objects from BP by script and use "Attribute(int attrTypeNum, int localeID)" function for it.
In ARIS help there is not note "This method is also available in Business Publisher Report." And all other Item-class functions don't have this note.
Script always finish succesful. But result sumetimes is proper and is not proper other times. Do someone know how to get attribute values form objects in BP reports? Functions like Name(-1) and GUID() always work properly.
Thanks!
Hi IIya,
Please check the below code, We need to use appropriate API Name of the attributes in an object. The below code consists of the API's which I used in my local,
var nLocale=Context.getSelectedLanguage(); function main(){ // creates an output object var oOutput=Context.createOutputObject(); //Begining of a table oOutput.BeginTable(100,Constants.C_DARK_BLUE, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); oOutput.TableRow(); oOutput.TableCell("Object Name",30,"Arial",10,Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell("Identifier",30,"Arial",10,Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell("Type",30,"Arial",10,Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell("Description",30,"Arial",10,Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell("Time of Generation",30,"Arial",10,Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell("Creator",30,"Arial",10,Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell("Last Change",30,"Arial",10,Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell("Last User",30,"Arial",10,Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); var models=ArisData.getSelectedModels(); for(var i=0;i<models.length;i++){ var oModel=models[i]; var objects=oModel.ObjDefList(); for(var j=0;j<objects.length;j++){ var oObject=objects[j]; var sobjectName = oObject.Name(nLocale); var sobjectID = getAttributeValue(oObject,Constants.AT_ID); var sobjectType = oObject.Type(); var sobjectDesc = getAttributeValue(oObject,Constants.AT_DESC); var sobjectTOG = getAttributeValue(oObject,Constants.AT_CREAT_TIME_STMP); var sobjectCreator = getAttributeValue(oObject,Constants.AT_CREATOR); var sobjectLC = getAttributeValue(oObject,Constants.AT_LAST_CHNG_2); var sobjectLU = getAttributeValue(oObject,Constants.AT_LUSER); oOutput.TableRow(); oOutput.TableCell(sobjectName,30,"Arial",10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sobjectID,30,"Arial",10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sobjectType,30,"Arial",10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sobjectDesc,30,"Arial",10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sobjectTOG,30,"Arial",10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sobjectCreator,30,"Arial",10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sobjectLC,30,"Arial",10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sobjectLU,30,"Arial",10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); } } oOutput.EndTable("",100,"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.WriteReport(); function getAttributeValue(oItem,nAttrType){ var oAttr=oItem.Attribute(nAttrType,nLocale); var sAttrValue=oAttr.getValue(); return sAttrValue; } } main();