Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Highlighted

New Here
,

Sep 01, 2020

Copy link to clipboard

Copied

I am using a form as part of a document portfolio to distribute and recieve the completed forms...I am exporting the document portfolio as a CSV so I can summarize data

I have a field (Field 3) that calculates a percentage from the numerator (Field 1) and the denominator (Field 2), which are the variables (they will always be integers) so I assign them a number format with 0 decimals

If I assign Field 3 as "None" it shows the number and many decimal places

Field 1: 60

Field 2: 70

Field 3: 1.16666666667 (and yes I realize the numerator is larger than the denominator in this example, nonetheless the issue is the same)

If I assign Field 3 as "Number, 0 decimals" it returns a number:

1 (rounded down I suppose)

If I assign Field 3 as a "Percentage" it returns:

116.67%

In all three cases: if you click into the field (in preview/data entry mode) it returns:

1.16666666667

I suspect the 1.16666666667 value is the one that is exported into the CSV...while not a big issue, I can write a function in Excel to round and convert the entire column into a percentage value or just use the value with the understanding of what a percent is (the value * 100)...**but I would rather the value be exported as a value of 1-100, no decimals or fractions thereof**

To arrive at the calculation the javascript is:

var numerator = +getField("NrShpIDReqWithID").value;

var denominator = +getField("TotalSheepReqID").value;

if (denominator!==0){event.value=numerator / denominator;} else {event.value="";}

I didn't write this script, and with limited knowledge of javascript, I am using it because it worked for the calculation from a previous form...maybe there is a better script with a parameter that defines how I would like the value exported (1-100 integer value)

Any help is appreciated...TIA

Adobe Community Professional

Use the custom calculation script like this:

```
var numerator = this.getField("NrShpIDReqWithID").value;
var denominator = this.getField("TotalSheepReqID").value;
if (denominator!==0) {event.value= util.printf("%.0f", (numerator / denominator)*100); }
if ((numerator=="")||(denominator =="")) event.value="";
```

TOPICS

PDF forms

Community Guidelines

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

New Here
,

Sep 01, 2020

Copy link to clipboard

Copied

I am using a form as part of a document portfolio to distribute and recieve the completed forms...I am exporting the document portfolio as a CSV so I can summarize data

I have a field (Field 3) that calculates a percentage from the numerator (Field 1) and the denominator (Field 2), which are the variables (they will always be integers) so I assign them a number format with 0 decimals

If I assign Field 3 as "None" it shows the number and many decimal places

Field 1: 60

Field 2: 70

Field 3: 1.16666666667 (and yes I realize the numerator is larger than the denominator in this example, nonetheless the issue is the same)

If I assign Field 3 as "Number, 0 decimals" it returns a number:

1 (rounded down I suppose)

If I assign Field 3 as a "Percentage" it returns:

116.67%

In all three cases: if you click into the field (in preview/data entry mode) it returns:

1.16666666667

I suspect the 1.16666666667 value is the one that is exported into the CSV...while not a big issue, I can write a function in Excel to round and convert the entire column into a percentage value or just use the value with the understanding of what a percent is (the value * 100)...**but I would rather the value be exported as a value of 1-100, no decimals or fractions thereof**

To arrive at the calculation the javascript is:

var numerator = +getField("NrShpIDReqWithID").value;

var denominator = +getField("TotalSheepReqID").value;

if (denominator!==0){event.value=numerator / denominator;} else {event.value="";}

I didn't write this script, and with limited knowledge of javascript, I am using it because it worked for the calculation from a previous form...maybe there is a better script with a parameter that defines how I would like the value exported (1-100 integer value)

Any help is appreciated...TIA

Adobe Community Professional

Use the custom calculation script like this:

```
var numerator = this.getField("NrShpIDReqWithID").value;
var denominator = this.getField("TotalSheepReqID").value;
if (denominator!==0) {event.value= util.printf("%.0f", (numerator / denominator)*100); }
if ((numerator=="")||(denominator =="")) event.value="";
```

TOPICS

PDF forms

Community Guidelines

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

Gregory5FBA

Sep 01, 2020
0
/t5/acrobat/data-formats-in-forms/td-p/11403620
4
Replies
4

Most Valuable Participant
,

Sep 01, 2020

Copy link to clipboard

Copied

Change:

event.value=numerator / denominator;

To:

event.value=Math.round((numerator / denominator)*100);

Community Guidelines

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

Reply

Loading...

try67

Sep 01, 2020
0
/t5/acrobat/data-formats-in-forms/m-p/11403698#M274379
New Here
,

Sep 01, 2020

Copy link to clipboard

Copied

The script returned a value of 100...the script below worked...Thanks anyway

Community Guidelines

Reply

Loading...

Gregory5FBA

Sep 01, 2020
0
/t5/acrobat/data-formats-in-forms/m-p/11403840#M274391
Adobe Community Professional
,

Sep 01, 2020

Copy link to clipboard

Copied

Use the custom calculation script like this:

```
var numerator = this.getField("NrShpIDReqWithID").value;
var denominator = this.getField("TotalSheepReqID").value;
if (denominator!==0) {event.value= util.printf("%.0f", (numerator / denominator)*100); }
if ((numerator=="")||(denominator =="")) event.value="";
```

Community Guidelines

Reply

Loading...

ls_rbls

Sep 01, 2020
0
/t5/acrobat/data-formats-in-forms/m-p/11403705#M274380
Gregory5FBA
LATEST

New Here
,

Sep 01, 2020

Copy link to clipboard

Copied

This script works so far, Thanks!

Community Guidelines

Reply

Loading...

Gregory5FBA

Sep 01, 2020
0
/t5/acrobat/data-formats-in-forms/m-p/11403841#M274392
Resources

About Adobe Acrobat

Adobe Inc

Adobe Inc

Adobe Inc

Adobe Acrobat Feature & Workflow

FAQs

Using the Community
Experience League
Terms of Use
Privacy Policy
Cookie preferences
AdChoices
Language:

- Deutsch
- English
- Español
- Français
- 日本語コミュニティ
- Português

Copyright © 2020 Adobe. All rights reserved.