One of the main features I was missing in Redmine has arrived: the possibility to make calculations from database fields. Let’s celebrate it with a post! 🙂
This functionality, whis was an old claim from many Redmine users and admins, that wanted it to be added to Redmine’s core, has been developed as a plugin from the community (user “annikoff”). You can download it here: https://github.com/annikoff/redmine_plugin_computed_custom_field.
The plugin adds a new custom field type called “Computed custom field” to Redmine’s database. When creating a new custom field and selecting this type, following form has to be filled in:
The most important field to be filled in is the “Formula” that will be applied to another custom field and that will calculate the result. We will then have to use a basic programming language, for which the plugin’s developer shows some examples very easy to understand.
Actully the major problem we will face is not to create the formula, but to know the custom field ID in the database of the fields we want to use. It would be easier to locate this ID if we had installed PHPmyadmin on our Redmine’s installation.
We can create fields that calculate integer or float numbers.
Here you can see another example for how to create the field and how you can use this new information in a tasks list:
This computed custom field multiplies the “Amount in US$” field by the USD/EUR exchange rate (0.87 in this case) and rouns it to 2 digits.
As you can see, after modifying the columns in the list, we have created a report in which you can see the equivalent amount in Euro, although the user only had to fill in the amount en US$ when updating the task.
Other examples for computed fields could be:
– in the task we give the number of kilos we have bought and how much the price of the kilo was, and automatically we will have the total amount in euros for the whole purchase:
– we give the amount of hours to invoice to a customer and the price rate for this task and the computed field will calculate the invoice amount.
– the computed fields can be used with any Redmine entity, not only in tasks, but also in users, contacts (for Redminecrm’s Contact’s plugin users), etc.
– you can use fields from different projects; one field is filled in in a project, another field in another project and the result is shown in a third project.
I still haven’t tested the plugin thoroughly, but I’m convinced that this module will importantly enhance Redmine’s reporting capabilities.