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

Please help me with conditional logic - it is breaking my brain

New Here ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

Hi there sorry for my ignorance I am very new at this

 

In the attached picture there are 4 columns

Each column has 3 tickboxes

 

Now I need to teel Acrobat that if any tick is made in Column A it has to add 150 to a field - so if you tick all there in Column A it must still remain 150

 

The same applies to Column B,C and D

 

In the end it has to be A+B+C+D= the max value it can be is 150+150+150+150=600

 

I hope someone can help

 

Thanks in advancequestion.jpg

TOPICS
PDF forms

Views

939

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 1 Correct answer

Community Expert , Jul 06, 2022 Jul 06, 2022

If your checkboxes are named "A1","A2","A3", same for B,C and D, use this as custom calculation script ot text field where you want to show result:

var t1=0,t2=0,t3=0,t4=0;
for(var i=1; i<=3; i++){
if(this.getField("A"+i).valueAsString != "Off")t1 = 150;
if(this.getField("B"+i).valueAsString != "Off")t2 = 150;
if(this.getField("C"+i).valueAsString != "Off")t3 = 150;
if(this.getField("D"+i).valueAsString != "Off")t4 = 150;}
event.value = t1+t2+t3+t4;

Votes

Translate

Translate
Community Expert ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

Setting a number (150) as export value in checkboxes makes calculations easier.

To be exclusive, checkboxes must have exactly the same name and a different export value.

Fortunately it is possible to use the same number written in 4 different ways as an export value so that the checkboxes remain exclusive, for example :
150
150.0
150.00
150.000

 

The result (text) field just has to calculate the sum of the checkboxes.

 

Capture_551.png

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
New Here ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

Thank you for your response

 

I did like you said but it tticks the boxes with the same name

 

Am I doing something wrong?

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
New Here ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

I had added the PDF

 

You will notice I cannot select A1 more than once except if I make a manual calculation

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
LEGEND ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

If boxes have the same name they WILL have the same value. You must use different names otherwise.

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
New Here ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

I rectified however it stills calculates all of them together

 

In this instance it is for an entry form where any three columns o A=150 same for the other however it has to be calculated together

 

 

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
LEGEND ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

There are many ways to the same answer. The chances are you will eventually have to work with Javascript&colon; your needs look as if you will eventually have to start programming. However, for now you can try setting the calculation for ATOTAL to be the MAXIMUM of A1,A2,A3 rather than the SUM.

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 ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

If your checkboxes are named "A1","A2","A3", same for B,C and D, use this as custom calculation script ot text field where you want to show result:

var t1=0,t2=0,t3=0,t4=0;
for(var i=1; i<=3; i++){
if(this.getField("A"+i).valueAsString != "Off")t1 = 150;
if(this.getField("B"+i).valueAsString != "Off")t2 = 150;
if(this.getField("C"+i).valueAsString != "Off")t3 = 150;
if(this.getField("D"+i).valueAsString != "Off")t4 = 150;}
event.value = t1+t2+t3+t4;

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
New Here ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

LATEST

Thank you all for the help

 

This worked perfectly

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