• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Calculation Setup

Community Beginner ,
Feb 24, 2021 Feb 24, 2021

Copy link to clipboard

Copied

Hi, is it possible to setup a form as per my example below?

I have 3 dropdowns (Course, Course Duartion and Course Code).

I would like to have it so the outcome of the course code selection is determinded by the choices selected on Course and Course duration.

 

For examples If you choose course A and a duration of 1 day, it auto selects Code A from the dropdown list options.

 

 

CODE + DURATION = CODE

A + 1 day = code A

A + half day = code b

B  + 1 day = code c

 

and so on. Does thatc make sense and can it be done?

TOPICS
Create PDFs , Edit and convert PDFs , General troubleshooting , PDF forms

Views

559

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Feb 24, 2021 Feb 24, 2021

You can use something like this as "Custom calculation script" of 3rd dropdown (Course code):

var c1 = this.getField("Course").valueAsString;
var c2 = this.getField("Course Duration").valueAsString;
if(c1 == "A" && c2 == "1 day")
event.value = "Code A";
else if(c1 == "A" && c2 == "half day")
event.value = "Code B";
else if(c1 == "B" && c2 == "1 day")
event.value = "Code C";
else event.value = "";

 

If you don't select choices from 3rd dropdown manually you can use text field instead.

Votes

Translate

Translate
Community Expert , Feb 24, 2021 Feb 24, 2021

Did you check "commit selected value immediately" in dropdown properties -> options tab?

Also check if all field names and values are correctly spelled.

If you still have problems share your file here or send it to me via PM and Il take a look into it.

 

Votes

Translate

Translate
Community Expert ,
Feb 24, 2021 Feb 24, 2021

Copy link to clipboard

Copied

You can use something like this as "Custom calculation script" of 3rd dropdown (Course code):

var c1 = this.getField("Course").valueAsString;
var c2 = this.getField("Course Duration").valueAsString;
if(c1 == "A" && c2 == "1 day")
event.value = "Code A";
else if(c1 == "A" && c2 == "half day")
event.value = "Code B";
else if(c1 == "B" && c2 == "1 day")
event.value = "Code C";
else event.value = "";

 

If you don't select choices from 3rd dropdown manually you can use text field instead.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 24, 2021 Feb 24, 2021

Copy link to clipboard

Copied

Perfect, I'll give this a go and let you know.

 

Thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 24, 2021 Feb 24, 2021

Copy link to clipboard

Copied

This seems to be working, but it will only populate the last option.

 

For instance on your example above it won't populate the value of Code A but only Code B.

 

You also have to select the text field to generate the info. Can it auto-populate the results by any chance?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 24, 2021 Feb 24, 2021

Copy link to clipboard

Copied

Did you check "commit selected value immediately" in dropdown properties -> options tab?

Also check if all field names and values are correctly spelled.

If you still have problems share your file here or send it to me via PM and Il take a look into it.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

LATEST

Hi Nesa,

Thank you thats now working,.

The issue was else event.value = ""; at the end of the orginal code. Once i removed that, it worked fine and when I set commit selected as per above, that worked fine as well.

Thank you for your help, its greatly appreciated,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines