Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Script to sum fields

New Here ,
Jun 24, 2021 Jun 24, 2021

Copy link to clipboard

Copied

Hi everyone.  You were all very helpful in one of my previous posts and I tried to take that information and adjust it to fit my new scenario but unfortunately seem to be running into a problem.

 

I want it to look to see if the date is filled in and if so take the total number of hours and multiply it by the pay rate.  Here is what I did:

 

if (this.getField("Date1").valueAsString=="") event.value = "";
else event.value = Number(this.getField("Hours1").valueAsString) x Number(this.getField("Pay Rate1").valueAsString);

 

Date is formated as Date and then Hours, Pay Rate and Total are all formatted as Number.

 

Any help is again appreciated.  Thanks

TOPICS
JavaScript

Views

290

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 ,
Jun 24, 2021 Jun 24, 2021

Copy link to clipboard

Copied

To multiply values use * not x

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
New Here ,
Jun 24, 2021 Jun 24, 2021

Copy link to clipboard

Copied

Thank you.  I corrected that and now I'm getting an error:

 

The value entered does not match the format of the field [Total1]

 

I did make sure that the fields were formatted correctly and that Total1 was in fact a Number.

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 ,
Jun 24, 2021 Jun 24, 2021

Copy link to clipboard

Copied

LATEST

What does you get when you change the format of this field to None?

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