Solved

Calculated Value: Calculate a Value from a drop-down response.


Hello Everyone,

 

I'm trying to Calculate a Value from a text response in a drop-down menu.  The drop-down menu has four choices; (1) Neither driven by or impacted to business initiative, (2) [Answer], (3) [Answer], (4) [Answer].  I would like answer (1) to equal 0 if selected.  I would code answers (2), (3) & (4) accordingly. 

 

The List = Problems.  The List Name = Impact of the effort - View.  The drop-down question is Impact of the effort.

 

My attempt at coding looks like this:  If("Neither driven by or impacted to business initiative","0","999")

 

Connected to:  Impact of the effort

 

Save:  Integer

 

Recalculate:  Yes, Yes, Yes.

 

Thank you for your time & help.

icon

Best answer by Garrett 11 July 2022, 23:38

View original

15 replies

Userlevel 6
Badge +16

Hi @Underdog 


 


You can assign a value to the answer in the drop-down field.


Instead of 


Answer 1
Answer 2
Answer 3
Answer 4


Use this


Answer 1|0
Answer 2|3
Answer 3|4
Answer 4|5


 


Example



Select Answer 1 - Question1 value is 0



 


Hope that helps


 


 


 

Userlevel 5
Badge +13

Which forms designer are you using - Classic or New Responsive?


 


If you're using the Classic designer, try using the formula below in the Formula field of the Calculated Value control. Make sure the "Save as data type" is set to Integer.


 


If(equals(Impact of the effort, "Neither driven by or impacted to business initiative"), 0, 999)


 


If you're using the New Responsive Designer, then you should be able to do this easier with a form rule to set the value of the control.

Hi Bamaeric,
Thanks for the quick response. I believe it's the New Responsive Designer. I you'd have any screenshots to assist, it would be greatly appreciated as I'm brand new to this software package.

Hi Garrett,


Thanks for the quick response.  The suggestion is a good one.  The conundrum for me is I desire their answer, but they can't see the number value assigned to it.  That number is added to six other numbers (from six other questions) to determine a priority score.  That's why the question is text, and I convert it to a score.


I believe my Nintex is "Responsive."  Another person suggest a Rule.  Would you have any insight or thoughts on that route?


Thanks for your help and time!

Userlevel 5
Badge +13

I created two controls on a New Responsive form: one "Choice Single" control named "Impact of the effort" for the drop down with your choices and one "Number" control named "Value" to store a value.


 


Add a form rule and configure it per the screenshot below.


 



 

Userlevel 6
Badge +16

Hi @Underdog 


 


I just want to illustrate the value to the answer hence why I showed the score.


If you don't want to show the scores, just hide the controls.(Visible = No)


But during development, its better to show the controls (Visible = Yes) for verification.


 


The 6 questions - Are the scores for the answer fixed set?


If yes, then use my suggestion.


<Text Answer>|<Score> e.g. Answer 1|0


If no, then use form Rules to assign score values


 


Assigning a value to the answer, saves you some time.


You avoid doing some codes or form rules as below


e.g. If ans == "Answer A", score = 5


If ans == "Answer B", score = 10


Question1 value is equals to the selection. 


 


Are you going to save the Score into a SP column?


If yes, then Users will be able to see the score.


 


You will still need Form Rules to 


- Calc the final score (can be done on the form, saving the form also saves the score) (can be done in the workflow too)


- show/hide additional questions depending on users; answer


 


Here is some additional resources to help you.


Have a look at this - On Input Rules



 


and this - Form Functions Sum


Userlevel 6
Badge +16

Hey @Underdog 


 


Both myself and @bamaeric have provided you with some great suggestions.


I hope that you are able to implement the suggestions into a proper solution for yourself.


Then is also the possibility of getting yourself confused.


 


Here are some guideline for you


1. Decide what is your Goal / What do you want to achieve with the Form and Workflow


2. Choose Simple rather than complex


3. Select easy maintenance and code readability


 


Hope that helps


 

The above makes sense. How do I access that screen. I'd send a screenshot of what I see, but don't see a way to attach it.
Userlevel 6
Badge +16

I capture screens with the Snipping Tool and paste it. Try it

Userlevel 5
Badge +13

To get to the Rules designer in the New Responsive Designer, click on the Rules tab at the top of the form designer and click on the "Add form rule" button. This will open the rule designer for a new rule like I have in my screenshot.

I don't see that tab. Would that indict I have the Classic version?

Userlevel 6
Badge +16

@Underdog 


 


You are using the Responsive Form



There is no wrong or right answer, but why are you using the Responsive Form?


Do you have a screenshot of your questions and the answers with scores?


 

Picture 3 is actually first, though listed second in the attachments.


The scores are:


Question #1 = 0


Question #2 = 1


Question #3 = 3


Question #4 = 9


Thank you very much for your help and time!

Userlevel 6
Badge +16

Just to clarify... what you actually meant is...



The scores for Question 1 are:


Question Answer #1 = 0


Question Answer #2 = 1


Question Answer #3 = 3


Question Answer #4 = 9


 


The value for the Dropdown List is <value>|<text>


"0|Answer #1,1|Answer #2,3|Answer #3,9|Answer #4"


For illustration purposes only - The Value is Underlined and the Text is in Italics


Note: There should NOT be any SPACES between the COMMA "," separator

Good morning Garrett,


Thank you for your response.  I added your response as advised:


0|[Answer]


1|[Answer]


3|[Answer]


9|[Answer]


Now the number is included, though the submitter cannot see it.  I'm going to do the same for the other six questions. 


I would now like to tally the amounts for all seven questions combined, to find a total amount .. a total score (if you will) .. ..  That total score I would translate to "None", "Low", "Medium" & "High".  I would like to have the score sent to me by e-mail, or put it in its own column in the Nintex List (Nintex:  List:  Problems:  Priority Score).


Thank you very much for your help.  I wouldn't have had any idea how to proceed without your help.


 

Reply