13 Replies Latest reply on Nov 1, 2012 3:34 PM by LaRetta

# negative number input box

Is there a way to set a number input box to be a negative number without if being related to anything else (not a calculation)?

• ###### 1. Re: negative number input box

Hi.

I just do an auto enter calculation into a number field. I set the calcuation to multiply by -1.

Table::negativeField x -1

I uncheck the "Do not replace existing values"

this will allow a number to be typed in and immediately change it to a negative number.

• ###### 2. Re: negative number input box

Thanks Jeremy, we just figured that out. I’ll mark the question answered.

• ###### 3. Re: negative number input box

Jeremy Brown wrote:

I just do an auto enter calculation into a number field. I set the calcuation to multiply by -1.

Table::negativeField x -1

I uncheck the "Do not replace existing values"

this will allow a number to be typed in and immediately change it to a negative number.

I am not sure what's the exact purpose here. If it's to always keep the entry negative, then it would probably be best to auto-enter =

- Abs ( Self )

Otherwise editing the field can flip the value back to positive.

Whether this is a well-behaved user interface is another question.

• ###### 4. Re: negative number input box

Michael,

I don't know what i'm doing wrong. It seems to work. I have a few fields that do that. I use a field that does sum(merit;demerit) and the demerit field gets entered as a 1, which gets replaced with a negative 1 through the auto enter calc field x (sorry this should be *) -1

It seems to work.

I've found that I don't always do something the most efficient way, but as long as it works, it works. right?

• ###### 5. Re: negative number input box

Thank you, we had solved it in house but didn’t get a chance to post the fix online.

• ###### 6. Re: negative number input box

Jeremy Brown wrote:

I don't know what i'm doing wrong.

Step 1: Enter 5 into the field. It gets changed to -5.

Step 2: Edit the field by changing -5 to -6. Now the entry will be changed to 6 (positive).

Jeremy Brown wrote:

as long as it works, it works. right?

Not really. You want it to work in all circumstances, not just in those you happened to test.

Message was edited by: Michael Horak

• ###### 7. Re: negative number input box

Table::negativeField x -1

Hi Jeremy, this works a treat if you want to REVERSE the field polarity.  That's probably what you were thinking.

• ###### 8. Re: negative number input box

LaRetta wrote:

this works a treat if you want to REVERSE the field polarity.

Ah, that's being concise. Thanks.

• ###### 9. Re: negative number input box

My pleasure (I'm studying Occam's razor, LOL) since you just made me laugh on "Not really. You want it to work in all circumstances, not just in those you happened to test" AND since I learned that reversal trick from you anyway!

Nope ... not me ... I only want calculations to work when I test them.

• ###### 10. Re: negative number input box

LaRetta wrote:

AND since I learned that reversal trick from you anyway!

Ahm... my reversal trick goes =

- Self

rather than =

Self * -1

• ###### 11. Re: negative number input box

ooops. then it must have been Ray. Well your reversal is now mine.

Wait ... here it is.  Does this look familiar?  I guess this was before Self came out!!

Multiplying a number by -1 reverses the sign:

1 * -1 = -1

-1 * -1 = 1

0 * -1 = 0

If you are using a condition to decide whether to reverse the sign, here's a fun calc that does that:

Amount * ( IsCredit - not IsCredit )

where IsCredit is a number with a boolean (0 or 1) value.

• ###### 12. Re: negative number input box

I know I made this mistake once. I am not sure you are quoting from that time, though. It could be just a different context.

• ###### 13. Re: negative number input box

LOL, it was different context ... it was discussing debit/credit calculations in general on reversing and boolean but the example was powerful to me so I kept it and I STILL will keep it because I not not love the logic of it.  :^)