Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column
width30%
Panel
borderColor#333f48
bgColor#FFFFFF
titleColor#eeeeee
borderWidth1
titleBGColor#333f48
borderStylesolid
titleOn this page

Table of Contents
maxLevel1

Column



Features used to implement the example



Example: Implement a form with a series of questions and calculate a numeric value based on the answers

I need assistance in adding a value to a text field based on the option selection. I am building out a change management form in Jira and there are a series of questions that is being created via custom fields.  Based Based on the option selected for the custom field, each field needs to be given a value of 1, 2, 3, or 4 (hidden values) and then I need to add a field value showing the Impact Rating result total (sum of the hidden values).

Example:

I created a custom field – Change in Software Release (new version)?

The option is set to -  Yes or None

If  Yes is selected, then I need to give the field a value of 4


This use case can be implemented using Mathematical and date-time expression calculator post-function with a formula similar to this one:

(%{aaaaa} = "Yes" ? 4 : 0) + (%{bbbbb} = "Yes" ? 1 : 0) + (%{ccccc} = "Yes" ? 2 : 0) + (%{ddddd} = "Yes" ? 4 : 0)

where aaaaabbbbbccccc and ddddd are field codes for custom fields that contain the answers to the questions, and 41, 2 and 4 are the values to the questions when the answer is "Yes".

You should select Impact Rating as target field, which should be a numeric custom field.

If you had questions with more than 2 options as possible answers, you would have use a formula like this one:

(%{aaaaa} = "Yes" ? 4 : 0) + getMatchingValue(%{bbbbb}, ["Yes", "No"], [3, 0]) + getMatchingValue(%{ccccc}, ["Yes", "Sometimes", "Almost Never", "Never"], [4, 3, 1, 0]) + getMatchingValue(%{ddddd}, ["Blue","Red", "Green", "Other colors"], [4, 3, 2, 1])



Other examples of that function

Incoming Links
pageMathematical and date-time expression calculator
labelsexample

Related Usage Examples

Content by Label
showSpacefalse
cqllabel = "example" and label = "custom-field"