Combine two fields with Misc custom field

werner kolze March 18, 2015

I followed the documentation to the latter trying to get two values of customfileds to combine it to one and I couldnt see the resulting field on the screen.

Here is the formula I used:  - ( an exact copy form the documentation, just changed the filed numbers to suit )


<!-- @@Formula: (issue.get("customfield_10111") != null ? issue.get("customfield_10111") : 0) + (issue.get("customfield_10115") != null ? issue.get("customfield_10115") : 0) --> 

 

 It states in the documentation that I should look thru the (atlassian-jira.log) - logfile, which I did, and it states in there:

secure/QuickEditIssue!default.jspa [innovalog.jmcf.fields.CalculatedTextField] CalculatedTextField: error evaluating formula of field "PIR Number" of issue PIR-23:
Parse error at line 2, column 41. Encountered: return

The "PIR Number" is defined a "Calculated Text Field" .

So I thought to better start a bit simpler and tried to just get a single value, the "Summary", to display and that failed as well.

Here is what I use:

<!-- @@Formula: issue.get("summary") -->

And nothing is displayed on the screen - so I look again in the logfile but there is no entry for any errors!

 

Thanks for all suggestions

3 answers

0 votes
werner kolze March 18, 2015

this is where I placed the formula   -  I figure that I want to have this working before I delve into the next adventure, combining two text fields, actually its a value from a dropdown as you said and the issue number, not sure how to get to the issue number either, yet.

- thanks for your fast response

I need some 25 points to answer any more questions - I dont know how to get these - I try here to answer some more questions - 

not sure what the view page is, but I included it on a screen - definately.
and yes I am looking at the issue itself.

thank you 

0 votes
werner kolze March 18, 2015

image2015-3-19 9:28:13.png

David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2015

This is the correct place. Did you make sure you included the calculated field in the View page? And did you look at the Issue itself, not the list of issues (which won't display the new field until you reindex)?

David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2015

Oh, and you can look inside atlassian-jira.log for ERRORs (right after displaying the issue)

0 votes
David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2015

The first error you listed wasn't generated by the formula you listed here - the formula has only one line and doesn't include a "return" statement, whereas the error points to a "return" statement on line 2.

Then the formula you used deals with numbers, and what you're trying to do is concatenate two text fields (I supposed) into one Calculated Text Field (not Number). So you should replace the zeros with empty strings ( "" ).

Then you should also make sure the two source fields are indeed Text fields. If they are Select fields (for example), then you need to add ".getValue()" after the call to "get(...)".

Finally, the last example is correct. So if it doesn't work, you should make sure you included the formula in the description of the Calculated Field, not in the description of the Field Configuration (the error is easy to make).

Miguel De Dios February 7, 2018

The last piece here was exactly my mistake. Pasting in the field configuration description will not work, it has to be the description under 'Edit' not 'Configure'

 

Thank you for this!

Suggest an answer

Log in or Sign up to answer