Hi guys, I'm an ARIS scripting noob (bout a month) and I'm required to write a report for any EPC model that lists the objects in the model according to the order in which they occur in the model.
for example the desired output for this model:
if all I print is the Object name for each object, is this:
Approved app received from Vision
Update app on C2
Agent contact customer to take up product
interest rate monthly repayment calculated
Agents make customer offer
OR rule
PATH SPLIT
path1
NONE
path2
Customer Negotiate term limit
PATH UNIFIED
In-store Card Product
PATH SPLIT
path1
Product created on C2
Product data with new rates, flag sent to vision
path2
Preagreement updated and sent to printer?
=========================================================================
now when I read the objects in from the model using the method 'currentModel.DFSGetNextNode();' I might get that exact output, but as soon as I run the report on a different maybe more complicated model, I get the kind of output where as soon as one "path" splits into two more, the objects come in an unpredictable order.
can anyone tell me how I would go about reading the objects in in the order in which those arrows flow?
We've been stuck with this for a very long time now and since almost no1 on the internet (developers) discuss ARIS scripting I don't have access to a very broad spectrum of expertise online.
can anyone help me with this please?
Hey Abdul,
Rather than attempting to find and create the forks and joins I produced a report that goes through each path and displays those paths seperately. The only time a fork or join happens is when an event occurs so we know those are the pivotal points in a process map.
Here is the recursive code that goes through and finds all the available paths and adds those paths into an array.
//path is an array //This function goes through all the nodes recursively, creating the path accordingly function find_paths(model, curObjOcc, path) { var children = model.GetSuccNodes(curObjOcc); var isCycle = false; for (var i=0;i<children.length;i++) { //We need to see if the children link back to a node that already exists in the path //This will remove the cycles that may exist for (j=0;j<path.length;j++) { if (path[j] == children[i]) isCycle = true; } } if (children.length == 0 || isCycle) { //Push this completed path into all Paths var tmpPath = new Array() tmpPath = tmpPath.concat(path); allPaths.push(tmpPath); tmpPath = null; return; } for (var i=0;i<children.length;i++) { if (children[i] != curObjOcc && !isCycle) { path.push(children[i]); find_paths(model,children[i],path); path.pop(); //This pops out the children we added, since it's recursive should always be last one } } }
Hi David,
how're you doing? thanks man! I've also got a recursive function, but I think there maybe something wrong with the function or how I'm working with those object outside of the function, I even have the same concepts/variable names as you!
Great minds...
I'll use this function and get back to you ;)
Hey David
thanks for that function man, really helped with the headache our guys have been sitting with for a while now, I just have to adapt it to the way the users want the output to be formatted in.
Thanks so much man, didn't have to do anything to that function, just create the global var allPaths, well done!