Skip to main content
Participant
November 23, 2023
Answered

Help! I am trying to make a combination of dropdown selections generate a model number.

  • November 23, 2023
  • 2 replies
  • 706 views

I have next to know experience with script but here is what I'm trying to do:

I have 2 dropdowns, the first drop down "VOLTS" has a list of options: 115/1, 220/1, 220/3 etc. I have assigned a letter code to each one as an export value: "115/1" = "DT", "220/1" = "DU", "220/3" = "DV" 

The second drop down "AMPS" has a list of options also with assigned export value codes: 0.9 to 1.3 = "0913", 1.1 to 1.6 = "1116" etc. 

I want a text field to take these export values and create a model number. For example if 115/1 is selected in "VOLTS" and 0.9 to 1.3 is selected in "AMPS" then I want it to generate a model number of DT0913 in a text field. 

 

This topic has been closed for replies.
Correct answer Nesa Nurani

You can use this script as custom calculation script of text field where you want to show model number:

var d1 = this.getField("VOLTS").valueAsString;
var d2 = this.getField("AMPS").valueAsString;
event.value = d1+d2;

If you have a default value in dropdowns when you don't want to show anything in text field you can add condition to the script, if you don't know how let me know and I will help.

2 replies

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
November 23, 2023

You can use this script as custom calculation script of text field where you want to show model number:

var d1 = this.getField("VOLTS").valueAsString;
var d2 = this.getField("AMPS").valueAsString;
event.value = d1+d2;

If you have a default value in dropdowns when you don't want to show anything in text field you can add condition to the script, if you don't know how let me know and I will help.

Participant
November 23, 2023

Worked perfectly. Thank you!

Participant
November 23, 2023

Next to no* lol