Hi!
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...
Cheers!
--Hugo
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?
Hi!
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);
Any ideas?
Thanks,
--Hugo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nic,
I just want to be able to use these values on the widgets (on a pie chart, two axis matrix, maybe) or acces to the value towards direct database access (why it's not stored properly?)
Cheers,
--Hugo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.