Hi,
I want to create a EPC Row display model from a EPC model and place the functions against there respective work roles based on connection type in various swimlanes or rows.
Can any one suggest how this can be done or which particular functions can be used to add rows / swimlanes in a EPC row display model.
Thanks in advance.
Hi Sunil,
you can either create a EPC Row model from scratch, create all lanes with the correct size and place the occs into it. (because report cannot create/move lanes if the model has any content). This is only the second best solution...
The best way would be to use model generation. Starting from an EPC, your code could look like the following:
function generateRowModel(oModel) { var modelGeneration = Context.getComponent("ModelGeneration") if(modelGeneration!=null) { var options = modelGeneration.createModelGenerationOptions(); options.setExpandModelDepth(0) options.setExpandModelDepthForProcesInterfaces(0) options.onlyCxnsWithOccs(true) options.multipleOccs(true) options.hideProcessInterfaces(false) var models = ArisData.createTypedArray(Constants.CID_MODEL) models.push(oModel) modelNewRowEPC = modelGeneration.generateModel(models, oModel.Name(g_nLoc),Constants.MT_EEPC_ROW, oModel.Group(), options) if(modelNewRowEPC!=null) { modelNewRowEPC.setAttrOccHandling(Constants.ATTROCCHANDLING_BREAKATTR) return modelNewRowEPC; } } return null; //model generation failed }
BR, Torsten
Hi Torsten,
Thanks for reply. But i am using aris 7.1 and the method createTypedArray is not available in arisdatat for me.
Also if you can suggest how we can add objects and connections to the respective lanes.
For example. In an epc if a workrole has a is responsible for relationship with activity function we will create a lane with name of work role and connection type I.e. active name of connection.
All the work roles having same type of relationship will be placed in this lane only. Similarly for other work roles and connection combination.
Can you please suggests how this can be done.
Thanks in advance.
Sunil Oza
Hi Sunil,
Refer this code.
Create EPC and delete/create vertical, horizontal lanes.
function main() { var nLocale = Context.getSelectedLanguage(); // Selected database language var aGroups = ArisData.getSelectedGroups(); // Selected Group var sModelName = "Text EPC Row Display"; // EPC Model Name var result = createOrGetModel(aGroups[0], sModelName, Constants.MT_EEPC_ROW, nLocale); } function createOrGetModel(cGroup, sModelName, cModelTypeNumber, nLocale) { var aDatabase = ArisData.getActiveDatabase(); var aSearchItem = aDatabase.createSearchItem(Constants.AT_NAME, nLocale, sModelName , Constants.SEARCH_CMP_EQUAL, false, true) var aModelList = cGroup.ModelList(false, [cModelTypeNumber], aSearchItem); var rModel = null; var aModel; // get existing model for (var i = 0; i< aModelList.length; i++){ aModel = aModelList[i]; if (aModel.Attribute(Constants.AT_NAME, nLocale).getValue() == sModelName) { rModel = aModel; break; } } // create model if same model is not existed. if (rModel == null) { rModel = cGroup.CreateModel(cModelTypeNumber, sModelName, nLocale); rModel.changeFlag(Constants.MODEL_RIGHT_ANGLED_CXNS, true); rModel.changeFlag(Constants.MODEL_HSYMBOL_OFF, false); } // Count swimlanes in Model var VLaneList = rModel.GetLanes(Constants.LANE_VERTICAL); var HLaneList = rModel.GetLanes(Constants.LANE_HORIZONTAL); // delete last vertical lane rModel.deleteLane(VLaneList[VLaneList.length-1]); // Add 2 vertical lanes for(var i=0; i<2; i++) { // add Organization Elements/Application system Type Lane rModel.createLane(Constants.LT_ORGELEM_APPSYS, Constants.LANE_VERTICAL); } // delete horizontal lanes for (var i=HLaneList.length; i>2; i--) { rModel.deleteLane(HLaneList[i-1]); } // add 2 horizontal lane for(var i=0; i<2; i++) { // add Carries out/Supports Type Lane rModel.createLane(Constants.LT_EXEC_SUPP, Constants.LANE_HORIZONTAL); } // if (rModel != null && rModel.IsValid()) // resModel.setTemplate (getTemplateGUID(), true); } main();
BR, Toven