Skip to main content
dhhsc84757271
Known Participant
January 31, 2019
Answered

Unable to perform a calculation on a set of dropdowns

  • January 31, 2019
  • 1 reply
  • 611 views

I have 6 dropdowns but based on space restrictions I had to include a script that showed the dropdown options on two lines instead of just one (kinda like a wrap around).  I have the export values set for each item and a text box (TOTAL) that is set to calculate the export value for each dropdown based on the selections.  However, the calculation is not happening.  I'm sure it has something to do with the "wrap around" script, but I have no idea what I need to do next.  Any suggestions would be appreciated.  Below is how I have things set up right now.

Dropdown1 through Dropdown 6:

ITEM:           FullyMet     MostlyMet     PartiallyMet     SomewhatMet     NotMet

EXPORT:          10               7.5                    5.0                    2.5                  0

Wrap around script on ACTION tab for each dropdown:

this.getField("Dropdown1").setItems(["Fully\nMet", "Mostly\nMet", "Partially\nMet", "Somewhat\nMet", "Not\nMet"]);

TOTAL box:  CALCULATE tab, Value is the sum(+) of the following fields: Q1, Q2, Q3, Q4, Q5, Q6

This topic has been closed for replies.
Correct answer try67

You did not set the export values. To do so you need to use this command:

this.getField("Dropdown1").setItems([["Fully\nMet", 10], ["Mostly\nMet", 7.5], ["Partially\nMet", 5], ["Somewhat\nMet", 2.5], ["Not\nMet", 0]]);

Note that adding line-breaks into the items of a drop-down field is not an official feature and tends to be buggy. I would recommend not doing it, if at all possible.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 31, 2019

You did not set the export values. To do so you need to use this command:

this.getField("Dropdown1").setItems([["Fully\nMet", 10], ["Mostly\nMet", 7.5], ["Partially\nMet", 5], ["Somewhat\nMet", 2.5], ["Not\nMet", 0]]);

Note that adding line-breaks into the items of a drop-down field is not an official feature and tends to be buggy. I would recommend not doing it, if at all possible.

dhhsc84757271
Known Participant
February 1, 2019

I was not aware that the line breaks could be an issue.  Thank you for that information.  Additionally, adding in the export values to the command worked perfectly!  try67​, Thank you for responding!