form logic calculation

Avatar

Avatar
Level 1
ryanr68196603
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
ryanr68196603
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile
ryanr68196603
Level 1

21-03-2018

Upfront,  I'm an Adobe Noob.  I can stumble my way through most of the things I do not know how to do but I am stuck on this one.

The situation.   I have a form that includes filled by the user.  These fields are "Purchase Price", "Less Concessions", "Less Home Warranty",  "LAComm" & "BAComm".    All are numbers.  I also have a drop down box where the user selects "Commission Based On:" and their choices are "Net" or "Gross".   Once the user inputs Purchase Price, Less Concessions & Less Home Warranty I have the form calculate the ""NetPurPrice".  That is easy. 

The Problem.   I have two fields that need a logical calculation.  "BuyComDue" & "ListComDue".  If the user selects Net from the drop down menu the "ComDue"s are based off of the NetPurPrice.  And obviously if the user selects Gross then we base the "ComDue"s on the PurchsePrice.

So how do I make the form do the following:

IF "Commision Based On" = Gross

     THEN "BuyComDue" = "PurchasePrice" x "BAComm"

     AND   "ListComDue" = "PurchasePrice" x "LAComm"

ELSE

     "BuyComDue" = "NetPurPrice" x "BAComm"

     AND   "ListComDue" = "NetPurPrice" x "LAComm"

SideNote:   Currently to get my NetPurPrice the user is forced to enter a negative value in "LessConcessions" & "Less Home Warranty".  I have the form forcing a neg. number using validation.  It works but I would like to make the form do subtraction vs. adding neg. numbers to reach my goal.  It would seem more user friendly.

Thank you for any and all assistance you provide.

Accepted Solutions (0)

Answers (5)

Answers (5)

Avatar

Avatar
Boost 5
Level 3
Thom_Parker
Level 3

Likes

5 likes

Total Posts

90 posts

Correct reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Level 3
Thom_Parker
Level 3

Likes

5 likes

Total Posts

90 posts

Correct reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
Thom_Parker
Level 3

21-03-2018

Is your form a LiveCycle Form?

Avatar

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile
try67
Level 2

21-03-2018

That is not how you access fields' values. Read the last part of the second tutorial I linked to.

Also, it's not how you write the JavaScript code. JS is case-sensitive. So you have to use "if", not "IF", and "else", not "ELSE", etc.

Avatar

Avatar
Level 1
ryanr68196603
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
ryanr68196603
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile
ryanr68196603
Level 1

21-03-2018

That is sort of what I figured. but using the following....

IF ( CommBase = Gross ) BuyComDue = PurchasePrice * BAComm

ELSE BuyComDue = NetPurPrice * BAComm

I receive...

SyntaxError: missing ; before statement

1: at line 2

I have tried everything. 

Avatar

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile
try67
Level 2

21-03-2018

Avatar

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile
try67
Level 2

21-03-2018