Currency Converter java script in pdf form

Community Beginner ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

Hello, how can I calculate currency in pdf forms?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

301

Likes

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
Adobe Community Professional ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

Just like you would calculate any other mathematical formula... If you want further help you need to provide more details.

Likes

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
Adobe Community Professional ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

Oh, if you mean that you want to convert from one currency to another, that's only possible if you use a fixed rate for the conversion.

Getting the rate from an external source, like a web-page, is extremely complicated.

Likes

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 ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

Yes I want to do it with fixed rate for the conversion.

But the formula?

And the structure of script in pdf forms?

I want to check four fields in pdf forms for values and their currency ID.
For example field 1 is for value, field 2 is for currency type of field 1.

I want to check these fields for calculate currency in field 25  where I need the  value calculated  in BGN.

My currensies are 7.
USD
AUD
EUR
GBP
CHF
JPY
BGN

The possibilities in field 2 and 4 are 6:  USD, AUD, EUR, GBP, CHF, JPY.
I want to check field 2 for the currency, if the currency is USD, then use the value from field 1 and  calculate it  with formula for USD to BGN in field 25 , with the value from field 1.


I need only one example how can I do it for USA to BGN.

And example how to switch to another formula for example if in field 2 the currency is  not USD, it is EUR, then I want to calculate  EUR to BGN. ??

Likes

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 ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

Yes I want to do it with fixed rate for the conversion.

But the formula?

And the structure of script in pdf forms?

I want to check two  fields in pdf forms for values and their currency ID.
For example field 1 is for value, field 2 is for currency type of field 1.

I want to check these fields for calculate currency in field 25  where I need the  value calculated  in BGN.

My currensies are 7.
USD
AUD
EUR
GBP
CHF
JPY
BGN

The possibilities in field 2 and 4 are 6:  USD, AUD, EUR, GBP, CHF, JPY.
I want to check field 2 for the currency, if the currency is USD, then use the value from field 1 and  calculate it  with formula for USD to BGN in field 25 , with the value from field 1.


I need only one example how can I do it for USA to BGN.

And example how to switch to another formula for example if in field 2 the currency is  not USD, it is EUR, then I want to calculate  EUR to BGN. ??

Likes

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
Adobe Community Professional ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

Do you have a drop-down field for the currencies? If so, then apply the rate as the export value of each item, and then simply using the Product option under the Calculate tab. Multiply the value by the rate, and you'll get the result.

Likes

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 ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

No, in field 2 the type of currency is change automatically when change country from drop down field 0.
If the country is USA the type of currency in field 2 will be USD if the country in drop down field 0 is Germany the currensy type in field 2 will be EUR.

Likes

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
Adobe Community Professional ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

Then you can use the export value of the Country drop-down field...

Otherwise you can just hard code it into a calculation script, like this:

var curr = this.getField("Currency").value;

var price = Number(this.getField("Price").value);

if (curr=="USD") event.value = price * 1.24;

else if (curr=="EUR") event.value = price * 0.82;

else if (curr=="GBP") event.value = price * 0.7; // etc.

else if (curr=="BGN") event.value = price;

Likes

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 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

A calculate field should still work, provided the calculation order puts the currency field ahead of the cost field.

Likes

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 ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

Okay, but if I am in this situation:

The country is Germany in field 0.
The value in field 1 is 35.
The currency in field 2 is EUR.

field 6 is  day counter, if I put 18/07/2018  start date in field 4 and 19/07/2018 end date in field 5, my counter is with value  3 in field 6.

Now day counter value * 35 calculation in field 9 the value is 105

in field 10 I want to convert this value from EUR to BGN.

Likes

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 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

LATEST

I think the sample posted is designed to do this. Put it on field 10, and change the field names in the first 2 lines to be the field names for fields 9 and 2.

Likes

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