Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to format at field to display absolute number

Status
Not open for further replies.

rutgers

Technical User
Apr 2, 2008
8
CA
I have one more question for you experts. I would like to format a field to display the absolute value of the number. For example, if it displays "4.5" I would like it to display "4".

Thank you again in advance!
 
You can create a formula like this


Abs({YourNumberField})

-- Jason
"It's Just Ones and Zeros
 
Hmm, that didn't work for some reason. It is a field generated by a formula. Could that be why?
 
Abs(ToNumber({YourFormula}))

-- Jason
"It's Just Ones and Zeros
 
OH WAIT....I just reread your original post....ABS wll not solve your problem....the abs of 4.5 is 4.5

You need to display whole numbers, no decimals. Yes?

-- Jason
"It's Just Ones and Zeros
 
Yes, I am sorry. I would like to display whole nunbers, with no decimals (and no rounding up or down).
 
//locates the decimal
numberVar x := instr(1,cstr({yourNumberField}),'.') ;
//moves 1 place before the decimal
numberVar y := x - 1 ;
//displays the left portion of the string up to the decimal
Leftcstr({yourNumberField}),y)

-- Jason
"It's Just Ones and Zeros
 
I noticed a typo in my post...


//locates the decimal
numberVar x := instr(1,cstr({yourNumberField}),'.') ;
//moves 1 place before the decimal
numberVar y := x - 1 ;
//displays the left portion of the string up to the decimal
Left(cstr({yourNumberField}),y)

-- Jason
"It's Just Ones and Zeros
 
I think you could just use truncate():

truncate({table.number})

-LB
 
True...and then modify the number formatting options to display no decimals...

Nice!

-- Jason
"It's Just Ones and Zeros
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top