I'm successfully using calculated custom fields, but the value is always calculated "on the fly". It's posible to update value each time is calculated on database? It would be very useful to use these fields on pie charts, widget, etc...
Er, values for fields are calculated when there's a change to the issue - i.e. "when it's calculated in the database".
If that's not what you're seeing, could you explain what you've set up in a bit more detail? The field type, what it does and when it is or is not being calculated?
Sorry... In order to explain my question with more detail... I've created a test environment. On a new Jira installation, two fields have been created:
- num1: number field
- calc1: calculated field with a formula on description that multiplies per 2 num1 (calc1 = num1 *2)
The field is calculated, and on every change of num1, it's value is updated. On table "customfieldvalue" in mysql database, I just can see a row, storing "num1" value. Where is "calc1" value in database?
From yesterday, I've checked the code, and I think that maybe it could be posible to "intercept" a "field.updateValue()" invocation on this method of CalculatedNumberField class:
public Object getValueFromIssue(CustomField field, Issue issue);
Ah, I see.
Those values are not stored in the database, only the index. It's a "derived" field.
I'm not sure why you want to intercept the getValue call here. If you want to make them available to the gadgets, I think you need to make sure they have a searcher, and from memory, something about statistics mapping. That exposes them to the gadgets then (you'd have to do that even if they wrote to the database)
There are two different things here.
1. A derived field does not need to be stored in the database. That's the whole point of them, they are derived entirely from other data, for the benefit of the humans who shouldn't have to work it out for themselves every time. In other words, not storing them in the database is the proper way to do it. Otherwise you've got pointless duplication and a potential for more error.
Their storage also has nothing to do with how they are displayed or used, which leads us to point 2.
2. When a field is needed, the process you are running asks the core of Jira for data from the field. Jira might read that from the caches, the database, or the index, but that really does not matter to the process calling for it. The problem you have here is that your process (e.g. the pie chart widget) does not know that the field is available to it because your code does not say "hey! I can be used by gadgets, here's how".
Even if you decided to store your derivation in the database, it would do you absolutely no good here, because it's irrelevant - your field needs the code that advertises it to gadgets.
I think (but I am very fuzzy on this, as it's a long time since I looked) that means you need a searcher and some form of statistics provider.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs