/////////////////////////////////////////////////////////////////////////// // Scripting Tutorial #8 - Common Coding Techniques /////////////////////////////////////////////////////////////////////////// // Title // Report to list all attributes from the current selected object(s) // // Main new features // - Report full compliant with Business Publisher // - Support for fixed file names for all output types // - Section Print – Only once // - Section Print – In case a name change is detected // - One single function for attribute printing // // Author // Volker Eckardt, Oracle Corporation, April 2010 /////////////////////////////////////////////////////////////////////////// // global variables for reuse var nLocale=Context.getSelectedLanguage(); var sScriptName=Context.getScriptInfo(Constants.SCRIPT_NAME); // Environment, returns STD or BP var sEnv = Context.getEnvironment() // Attribute Header Values and Width // Changed in PART 8 var headerList = [getString("ID_ATTRIBUTE"), getString("ID_VALUE")] var hWidthList = [50,50] // To show only maintained attributes set to false var bShowNotMaintainedAttr = false // To force a fixed Excel file name, set to true var bUseFixedOutPutFileName = true // Font Size List var aOutputFontSizeList = [getString("ID_FONT_SIZE_SMALL"), getString("ID_FONT_SIZE_MEDIUM"), getString("ID_FONT_SIZE_LARGE")] var nOutputFontSizeOffset = 1 // NEW IN PART 8 // Write DB Info Only Once var bDBInfoOnlyOnce = true // Write Model Only Once var sPreviousModelName = "" /** Main Function */ function main(){ // NEW IN PART 8 if (bUseFixedOutPutFileName) // if requested, assign a fixed file name var oOutput=Context.createOutputObject(Context.getSelectedFormat(),getFixedFileName()); else // Create an output Object var oOutput=Context.createOutputObject(); // define page and write Header + Footer writeHeaderAndFooter(oOutput) // define the styles defineStyles(oOutput); // set the html page title oOutput.SetTitle(Context.getScriptInfo(Constants.SCRIPT_NAME)) // NEW IN PART 8 // Validate, if standard execution is requested (not BP) if (sEnv == "STD") { // read the current selected object occurrences var objoccs = ArisData.getSelectedObjOccs(); } else { // set to an empty array by now var objoccs = new ObjOcc // also possible: var objoccs = [] } // if no object occurrence is selected, try also objectdef if (objoccs.length == 0) { var objDefs = ArisData.getSelectedObjDefs (); // is at least one object is selected // hint: you can select multiple objects in the search result window if (objDefs.length > 0) // collect referenced object occurrences objoccs = collectObjOccs(objDefs) else { // if no objOcc and no objDef is selected, try model var modDefs = ArisData.getSelectedModels() // is a model selected? Take the first only. if ( modDefs.length > 0 ) objoccs = modDefs[0].ObjOccListFilter() } } // if at least one object selected if (objoccs.length > 0) { // loop through all objects in the list for (o=0;o