Profile picture for user Nique

Hi,

Do you have Processes and Functions with Numbers? More human readable than the Identifier?

We do, and this number is also following some hierarchical structure.

So, we have our own Attribute to store this information (formated like nn.nn.nn.nn). You think at the attribute called Structure ID (AT_STRUCTURE_ID)? We first too, but this is only for integer values, we needed a string. Thats the reason why we have a user defined attribute.

But guess what, to fill this attribute, you need a lot of time, you make a lot of faults, it's .....

So, how can this be supported?

Following, I try to explain our solution (seams to work, but is probably not very stable).

Chears,

Dominik

by Dominik Jenzer Author
Posted on Thu, 07/12/2012 - 17:34

Conceptuatl Solution:

First of all, what is in our DB.

We use Models with Functions (wow ;-). Our Hierarchy is build with Value Chain Diagramms. The lowest level is an EPC Diagramm. Or Numbering is following the hierarchy:

Business Process (nn) contains

Business Cases (nn.nn) contains

Processes (nn.nn.nn) contains

Functions (nn.nn.nn.nn) and Events (nn.nn.nn.nn)

The process number is stored in a User Defined Attribute called structure-ID

Our idea:

In a model, you select a Function/Event, call a macro and this stores the next possible process number in respect of the hierarchy.

0
by Dominik Jenzer Author
Posted on Thu, 07/12/2012 - 18:12

How to call the macro:

First of all, you need something, that is very quick to reach. This is a macro, directly placed in the menu bar.

1. create a new macro (e.g. process numbering), available for users

2. choose the context (unforunalty "no context", because we can not set the context to Object Occurances, only to Objects - and this will not work). So train the users, what has to be selected to let the macro run: functions or events

3. the content wil be user defined (for our script)

4. edit the script as described below

5. Configure the macros in the menu "Reporting", select the checkbox for the menus and choos an icon

You will find the icon in the menu-bar just after the "properties"-icon, within the reporting-section. If the icon is greyed, then the selection doesn't match. So, in our case, the icon should allways be there ;-)

6. Use the macro:

6.1 Open a model

6.2 Select the Object (Function or Event) to number

6.3 klick the Macro-Icon

6.4 Repete  the steps 2 and 3 and dont forget to save the model at the end



The script in steps:

1. We need the selection

selection = Context.getSelectedObjOccs();

As we get only the SelectedObjOccs, it doesn't matter if the user has selected some other elements as the model or objects itself. But be aware, the user may also select some rules...

2. Only to avoid some error, we go only, if the selection has a least one Occurance

if(selection.length > 0) {

// here we will have later the action

}

2a. When a user selects more than one object (what is possible), you are not shure, what is the right way to number the selected Occurances. So probably to something to avoid a selection of multiple Occurances and do a message-box

3. Do a call of a report. Because not all needed operations are available in macros, the main work is in a report-script.

report = Report.createExecInfo("FIRM/08942870-cb5d-11e1-4c05-005056b57173", selection, Context.getSelectedLanguage());
result = Report.execute(report, Context.getShowResult());

So, "FIRM/08942870-cb5d-11e1-4c05-005056b57173" is the GUID of the Report-Script. When you have created your report, take your proper GUID from the report-properties

4. Very important, when the numbering is done, you don't see it in your model. So we have to refresh the model

Designer.refresh(Designer.getModel(selection[0]));

This is very handy. That means, we refresh a model that is allready open (if not, we will never have a selected Occurance). And because we can only have a selection within the same model, it is enough to get the model from the first selection (selection[0]). This is why we check the length in the step 2.

Full script:

var selection;
var report;
var result;

selection = Context.getSelectedObjOccs();
if(selection.length > 0)
{
 report = Report.createExecInfo("FIRM/08942870-cb5d-11e1-4c05-005056b57173", selection, Context.getSelectedLanguage());
 result = Report.execute(report, Context.getShowResult());
    Designer.refresh(Designer.getModel(selection[0]));
}

 

0
by Dominik Jenzer Author
Posted on Thu, 07/12/2012 - 18:33

The Report:

First, we need a new report. Don't forget to copy the Identifier to the macro. You will see the Identifier on the first part of the report-properties. And make sure, that the user can't run the report directly. The report should open dialogs and must write the DB.

The context here is object (Function and Event), but this doesn't help for miss-selections as rules.

Actually, I have no idea to prevent running on rules. So the script runs, but does only increment the hwm (high water mark). Probably you have an easy idea? Let me know.

So, lets go directly to the script

1. What are the user defined attributes

We need two of them. One stores the process number in the object, the other stores the so called high water mark in the model. The hwm is the latest number used for numbering.

var g_AT_hwm = ArisData.ActiveFilter().UserDefinedAttributeTypeNum("89f4cc20-cbe0-11e1-4c05-005056b57173");
var g_AT_procNr = ArisData.ActiveFilter().UserDefinedAttributeTypeNum("851fe600-ab27-11e1-4c05-005056b57173");

Please replace the Identifier of both attributes with your identifiers.

2. We need the current language setting to get the right value of the attributes later

var nLocale = Context.getSelectedLanguage();

3. We need the selection from the macro

aSelOcc = ArisData.getSelectedObjOccs();
aSelOcc = ArisData.sort(aSelOcc,Constants.AT_NAME,Constants.AT_ID,nLocale);

The first line gets the data (an Array), the second sorts it. Be aware of the sort criteria

1. Name of the Object

2. ID of the Object

So, if you have selected more than one object, the numbering will be in order of the name, nothing else! Probably this is not what you want, so avoid to have more than one object in the selection (add this in the macro)

4. Lets run the selection

for (var i=0;i<aSelOcc.length;i++) {
// do some more action
}

The action will be explained later, in the following parts, I explain to general functions we use.

0
by Dominik Jenzer Author
Posted on Thu, 07/12/2012 - 18:37

Some useful functions to manipulate arrays:

function contains(aArray,aElement) {
 for(var i=0; i < aArray.length; i++) {
    if(aArray[i].toString().equals(aElement.toString())) return true;
  }
 return false;
} 

This Function returns true, if an Element (aElement) may be found in an Array (aArray).

 

function cleanArray(aArray) {
  var aCleanArray = [];
  for(var i=0; i < aArray.length; i++){
    if(!contains(aCleanArray, aArray[i])) aCleanArray.push(aArray[i]);
  }    
  return aCleanArray;      
}

This Function usese the function above (!) and eliminates duplicity in an array. So every Element will only be once in the array

 

The Idea is taken from the communUtils.js - so thak you guys.

0
by Dominik Jenzer Author
Posted on Thu, 07/12/2012 - 21:08

Lets continue the main work.

In our case, the hierarchy normaly (should) have allready a process number. So we need to add some numbers to it. The next step is, to get the process number from the parent, I call it the prefix.

This is done in a separate function we call later.

1. We need the Object Definition of the Object assigning the Model. We get the Model from the Occurance. Be aware that we get an Array.

aParentObjDef = oObjOcc.Model().SuperiorObjDefs();

2. We run trough the array and will wtore only the process number (as a string) from the parent in a new array

    for (var i=0;i<aParentObjDef.length;i++){
        aParentProcNr.push(aParentObjDef[i].Attribute(g_AT_procNr,nLocale).getValue());
    }

There can be really more than one object as parent. This is possible, when 2 Objects uses the same Model. In our environment, this is not usual and prevent by some other qs-reports. So the following work is a bit shaky.

3. Clean the array and remove duplicity (see the general function above)

aParentProcNr = cleanArray(aParentProcNr);

4. If we have one Element in our array, I return this, else, I return 0 (this is the shaky part)

    if (aParentProcNr.length = 1) return aParentProcNr[0];
    else return 0;

So, lets look at the whole function:

function getParentProcNr(oObjOcc){
    aParentProcNr = [];
    aParentObjDef = oObjOcc.Model().SuperiorObjDefs();
    for (var i=0;i<aParentObjDef.length;i++){
        aParentProcNr.push(aParentObjDef[i].Attribute(g_AT_procNr,nLocale).getValue());
    }
    aParentProcNr = cleanArray(aParentProcNr);
    if (aParentProcNr.length = 1) return aParentProcNr[0];
    else return 0;
}
0
by Dominik Jenzer Author
Posted on Fri, 07/13/2012 - 08:06

We come to the end, we build the action-part

1. We need some information: Prefix, the Model of the Occurance and the HWM of this Model

    sPrefix = getParentProcNr(aSelOcc[i]);
    oModel = aSelOcc[i].Model();
    sHWM = oModel.Attribute(g_AT_hwm,nLocale).getValue();

2. We have to do some consistency things as:

- be shure that hwm has at least 0 if not allready defined

- raise the hwm to the new value (build as incrementing a string-value)

- add a leading 0, because we want to have the numer 01 instead of 1

    if (sHWM.length == 0) sHWM = 0;
    sObjNr = (Number(sHWM) + 1).toString();
    if (sObjNr.length == 1) sObjNr = "0" + sObjNr;

3. Finaly we

- set the new processnumber build from the prefix and the new hwm

- we "touch" the object, that gives a modification timestamp to the object

- we store the new hwm back to the model, to use it on the next run

    aSelOcc[i].ObjDef().Attribute(g_AT_procNr,nLocale).setValue(sPrefix + "." + sObjNr);
    aSelOcc[i].ObjDef().Touch();
    oModel.Attribute(g_AT_hwm,nLocale).setValue(sObjNr);

This is it. store - run - enjoy and comment it here

Let us also know, if you have any correction or enhancement

Here you have the whole report script

Chears

Dominik

// Configuration
var g_AT_hwm = ArisData.ActiveFilter().UserDefinedAttributeTypeNum("89f4cc20-cbe0-11e1-4c05-005056b57173");
var g_AT_procNr = ArisData.ActiveFilter().UserDefinedAttributeTypeNum("851fe600-ab27-11e1-4c05-005056b57173");

// Definition
var nLocale = Context.getSelectedLanguage();

// Run
aSelOcc = ArisData.getSelectedObjOccs();
aSelOcc = ArisData.sort(aSelOcc,Constants.AT_NAME,Constants.AT_ID,nLocale);

for (var i=0;i<aSelOcc.length;i++) {
    sPrefix = getParentProcNr(aSelOcc[i]);
    oModel = aSelOcc[i].Model();
    sHWM = oModel.Attribute(g_AT_hwm,nLocale).getValue();
    if (sHWM.length == 0) sHWM = 0;
    sObjNr = (Number(sHWM) + 1).toString();
    if (sObjNr.length == 1) sObjNr = "0" + sObjNr;
    aSelOcc[i].ObjDef().Attribute(g_AT_procNr,nLocale).setValue(sPrefix + "." + sObjNr);
    aSelOcc[i].ObjDef().Touch();
    oModel.Attribute(g_AT_hwm,nLocale).setValue(sObjNr);
}


// Supporting Functions
function getParentProcNr(oObjOcc){
    aParentProcNr = [];
    aParentObjDef = oObjOcc.Model().SuperiorObjDefs();
    for (var i=0;i<aParentObjDef.length;i++){
        aParentProcNr.push(aParentObjDef[i].Attribute(g_AT_procNr,nLocale).getValue());
    }
    aParentProcNr = cleanArray(aParentProcNr);
    if (aParentProcNr.length = 1) return aParentProcNr[0];
    else return 0;
}


// General Functions
function cleanArray(aArray) {
  var aCleanArray = [];
  for(var i=0; i < aArray.length; i++){
    if(!contains(aCleanArray, aArray[i])) aCleanArray.push(aArray[i]);
  }    
  return aCleanArray;      
}

function contains(aArray,aElement) {
 for(var i=0; i < aArray.length; i++) {
    if(aArray[i].toString().equals(aElement.toString())) return true;
  }
 return false;
} 
0
by Theo Padding
Posted on Thu, 07/19/2012 - 15:38

Hi, we faced the numbering problem for many years. The problem with automatic numbering is that it is almost impossible to do that automatically (at least not for our users...). What we have done is to create a Sort object (based on Technical Term) and link that to a Function. This object is used for sorting process steps in reports and we provide a library with a standard set of Sort objects (1, 1.1, 1.2, 2 and so on) for re-use. Because a Function can be re-used in other processs models the number is not the same in all models. In the models an occurrence of the Sort object can be used, so this problem is also avoided. Therefore we decided not to store it in an attribute. Besides that, users that generate a report may not have write priviliges. We faced issues with that in the past, when we used an attribute. So we decided to, besides automatic numbering, add manual numbering in process models.

Unfortunately this solution is a workaround. It would be better if all models in ARIS would contain such an object, so that sorting of objects (of any kind) is not a problem any more. I hope this can be solved in one of the next releases of ARIS.

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks
  • Profile picture for user freddy
  • Profile picture for user mikhubb
  • Profile picture for user harryratia
  • DC
  • ВА
  • PacMan

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock