I’m working on setting variables to subtract a couple of fields and get a result. No problem there. I added a $ and decimal feature to the script to get $10.00. When I get a negative number it formats it as $-10.00. How can I get the $ sign to be inside the negative number?

One way to do this is to add a global variable (set to the same value as diffTotal) and some conditional logic to check to see if that variable is greater than or = 0.

You can use the logic you’ve already got, just change it to:

-$[[((LVAR1 - LVAR2)*-1).toFixed(2)]].

This way you place the ‘-’ outside of the dollar sign, and you multiply the sum by -1.

Make sure you toggle ‘if/else’ on your cases, so that each case reads IF. Here’s the file with those updates:

To break this down:
We start with a string of ‘$’, then append your formatted number, and finally
search the resulting string for ‘$-’ and if if’ts found replace that with ‘-$’.

What if i want to have a couple of fields (supp1 and supp2) total down to suppTotal and that does the combination with diffTotal to put the results in diffReadOnly (see enclosed project)?

I can make the diffTotal add up supp1 and supp2, but i keep failing at then getting that to put that result in diffReadOnly. I’ll keep at it in the meantime.

Have a look at the attached. I centralized the logic to “onMove” of your diff total so you don’t have to update so many different places with logic. Then each text field has a case that says to move the diff field on text change. Let me know if you have any questions.