Combine two fields with Misc custom field

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

This widget could not be displayed.

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).

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!

This widget could not be displayed.

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

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)?

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

This widget could not be displayed.

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 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

146 views 2 0
Join discussion

Atlassian User Groups

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!

Find my local user group

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

Groups near you