BAM Calculated Fields

In my previous blog, I have made a start with the study of the BAM components. I have started with the Data Objects (BAM Data Objecten). In this post I will continue with them.


In order to be able to make the desired dashboard for the POC, there is a need for yet a number of calculated fields. These calculated fields are defined as part part of the Data Object. Several of the required calculated fields are also present in the standard Data Objects. These can be taken over. Because the field names do not match directly these must still be adapted. In the standard Data Objects are all calculated fields defined as attribute. To give them some context I have defined some of them as dimensions and measure. But this affects the different queries where this is not immediately obvious. It is stated at the different query types but it is rather unclear. The following screenshot show a number of them in BAM (sorry it’s in dutch).

A subset of the fields is also added in the list below. The complete list can be downloaded here. The selected fields are a representative selection of the different variants and which also need some additional explanation.

  1. OpenTask
    indicates if the task is open (1 = Open, 0 = Closed).
    IF({Component Type}==”HUMANTASK”&&{Activity Status}!=”COMPLETED”) THEN(1)ELSE(0)
  2. TaskOpenedToday
    indicates if the task is opened today (1 = Opend Today, 0 = Opend before today)
    IF({Component Type}==”HUMANTASK”&&
    DAYOFYEAR({Activity Start Time})==DAYOFYEAR(NOW())&&
    YEAR({Activity Start Time})==YEAR(NOW()))
  3. TaskOpenedBeforeToday
    indicates if the task is opened before today (1 =  Opend before today, 0 = Opend Today)
    IF({Component Type}==”HUMANTASK”&&
    DATEDIFF(SQL_TSI_DAY, NOW(),{Activity Start Time})>1)
  4. RiseTodaysTasks
    Percentage rise of open tasks today (relationship between 2 and 3)
  5. DaysUntilDueDate
    Days Until Due Date
    ROUND(DATEDIFF(SQL_TSI_DAY, NOW(),{Activity Due Time})+0.5,0)
  6. TaskIsDueSoon
    Due date is almost reached (1 = Almost Due, 0 = in good time)
    IF({Component Type}==”HUMANTASK”&&
    {Activity Status}!=”COMPLETED”&&
  7. DurationIcon
    Show a different icon depending on the age of task (< 5 days = green check mark, 5 .. 10 days = yellow exclamation mark, > 10 days = red cross)
    if({Task Age In Days}<5)
    then(Concat(Concat(“<img src=’myImages/ico-goed.png’ height=’15’ width=’15’ alt='”,{ Task Age In Days}),”‘ />”))
    else(If({Task Age In Days}>10)
    then(Concat(Concat(“<img src=’myImages/ico-fout.png’ height=’15’ width=’15’ alt='”,{ Task Age In Days}),”‘ />”))
    else(Concat(Concat(“<img src=’myImages/ico-attentie.png’ height=’15’ width=’15’ alt='”,{ Task Age In Days}),”‘ />”)))
  8. TaskUrl
    Part of the url to the humantask. Is used to construct a link to the humantask.

Notes on the calculated fields.

Calculated field 1 and 2 are pretty straight forward. Component Type and Status are used to determine if it’s an open task. The Activity Start Time is used to put the event somewhere on a timeline.

In calculated field 3 (TaskOpenedBeforeToday) something similar is done, but now the calculation is done using the DATEDIFF function. Disadvantage of this feature is that it is not supported in CQL. This makes it unsuitable for the use in active data views. In order to be able to make use of active data the calculated field should be implemented in a different way. In this case this is not very complicated. Outcome is an inverse of calculated field 2. So 3 can be adapted for example to:

  • IF
    ({Component Type}==”HUMANTASK”&&
    DAYOFYEAR({Activity Start Time}) ==DAYOFYEAR(NOW())&&
    YEAR({Activity Start Time})==YEAR(NOW()))


  • IF({TaskOpenedToday }==1)THEN(0)ELSE(1)

In the second implementation another calculated field is used (this to show that it is not restricted to the DO columns). In calculated field 4 this is also done.

In calculated field 5 we have the same problem with de DATEDIFF function. To make use of active data I have change this in:

  • IF(YEAR({Activity Due Time})==YEAR(NOW()))
    THEN(DAYOFYEAR({Activity Due Time})-DAYOFYEAR(NOW()))
    ELSE(365+DAYOFYEAR({Activity Due Time})-DAYOFYEAR(NOW()))

There is still one issue with this field. I have used the hardcoded 365 days a year. But of course this does not work all the time. But at the moment I could not find a method to get the last day of a year. For now I keep it this way.

In calculated field 6 there is also something special. It contains a parameter. The parameter ‘UrgentWithinDays’. This parameter indicates when a task becomes urgent. By using a parameter everywhere the urgency is required helps to improve maintainability. If the number of days when a task becomes urgent is chanching, this change need to be made in one place. The parameter is now set to 3 days. The parameter specification is also part of the DO definition (underneath the calculated fields).

Calculated field 7 is filled with a piece of html. For example: <img src=’myImages/ico-goed.png’ height=’15’ width=’15’ alt='”,{TaskDuration}),”‘ />”. This code means that the image ‘ico-goed.png’ is show in the field, and if the image is not found, the value of {TaskDuration} is shown. Depending on the value of {TaskDuration} a different image is shown. You can use any image you like for this. In my virtual machine the images are located in the following directory (for you it might be different):

/u01/oracle/fmw/user_projects/domains/base_domain/servers/bam_server1/tmp /_WL_user/BamComposer/6ez7wd/war/images.

I have added a new higher level directory containing the images which I want to use. So my own pictures are not between the default images helping to keep things maintainable.

Field 8 contains the unique id of the humantask in Oracle BPM. Later on in my ‘Business Views’ post I will use this to construct I link to the task.

In my next post I will go to the next part of the development process. There I will write about the Queries. The queries will be built on the created Data Object.

note: because this blog is part of a larger whole (series) it can happen to this post as if context is missing. To get a good impression of the big picture, I recommend to read (or quickly scan) the previous posts in this series.

You can dowload the Data Object (including the Calculated Fields) here.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s