Copy link to clipboard
Copied
Hi
This may be a stupid question.
I am setting up a form for risk assessments and I have 2 drop down fields with consequesnce and Likelihood (both 1 to 5) what i would like to automatically fill a third field with a similar total as the attached image.
is this actually possible or am I going too far with it?
Thank you for the thoughts on this
Matthew
Copy link to clipboard
Copied
Hi,
I assume the result is supposed to be in the risk field, in which case the code would need to be on the calculate of the risk field and it would need to be something like
// get the value from the text3 field
// change this if the field is named differently
var text3value = this.getField("text3").value;
var riskString = "";
if ( text3Value >= 15){
riskString = "extreme";
} else if (text3Value >= 8 && text3Value <= 10){
riskString = "high";
} else if ( text3Value >= 4 && text3Value <= 7){
riskString = "Moderate";
} else if ( text3Value >= 3){
riskString = "Low";
}
event.value = riskString;
Copy link to clipboard
Copied
Use the script at calculation of the field.
Copy link to clipboard
Copied
You doesn't set event.value
Copy link to clipboard
Copied
Sorry i think i was making it too hard
I have set a quick table up
the total box multiply the chance and the severity boxes to give me a number between 1 and 25.
I then think i put action to run the below javascript,
(text3>=15,"extreme",IF(text3>=8<=10,"high",IF(text3>=4<=7,"Moderate",IF(text3>=3,"low"))))
I have put this onto a box under risk but it is not showing anything so i think i have mucked up somewhere.
any help would be appriciated.
Copy link to clipboard
Copied
Hi,
I assume the result is supposed to be in the risk field, in which case the code would need to be on the calculate of the risk field and it would need to be something like
// get the value from the text3 field
// change this if the field is named differently
var text3value = this.getField("text3").value;
var riskString = "";
if ( text3Value >= 15){
riskString = "extreme";
} else if (text3Value >= 8 && text3Value <= 10){
riskString = "high";
} else if ( text3Value >= 4 && text3Value <= 7){
riskString = "Moderate";
} else if ( text3Value >= 3){
riskString = "Low";
}
event.value = riskString;
Copy link to clipboard
Copied
Hi
Thank you for this you are correct i wanted to put this into the risk field (would have helped for me to say that one sorry)
I am getting the same thing that either the script isnt working or isnt running as nothing happens in the risk field.
I must have an option that is set wrong (i do have it on select trigger mouse up)
Copy link to clipboard
Copied
Use the script at calculation of the field.
Copy link to clipboard
Copied
thanks, i have put this into the custom but it still doesnt show the text.
I have attached the PDF I think i must have done something completely wrong, as my brain has melted away
Copy link to clipboard
Copied
Don't use Simplified field notation for the script.
Copy link to clipboard
Copied
Even on custom it comes as blank
Copy link to clipboard
Copied
You doesn't set event.value
Copy link to clipboard
Copied
if i could do a bowing emoji that worked I would put it here.
after all that it was mainly because i forgot the last line on the javascript that BarlaeDC put on
Thank you so so much

