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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Numeric Fields

Status
Not open for further replies.

jigga

Programmer
Joined
Aug 9, 2000
Messages
1
Location
KY
I have formatted a number field to display values using 4 decimal places eg. 3.7953<br>This is fine when the places after the decimal point are non zero. How do I force the number to be printed without the decimal places when there are no values after the decimal point?<br>At the moment I get 1.0000 and I really want 1<br><br>I only need to see the parts after the decimal point when there is actually a value to display.
 
How about changing your numeric field to text and then checking the last 4 char if zeros.&nbsp;&nbsp;If so, pull just the first char.&nbsp;&nbsp;Create a formula ie:<br><br>first_formula:<br>&nbsp;&nbsp;totext(num_field)<br><br>Then create another formula that says:<br>second_formula:<br>&nbsp;&nbsp;&nbsp;if right(first_formula,4) = '0000' then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;left(first_formula,1)<br>&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num_field<br><br>Try this and let me know if it works.<br>&nbsp;&nbsp;&nbsp; <p>LindaC<br><a href=mailto:lcastner@co.orange.ny.us>lcastner@co.orange.ny.us</a><br><a href= > </a><br>
 
Another way...<br>In format number, decimals<br><b>If num_field\1 = num_field then 0<br>Else 4<\b><br>This keeps the number in number format, which may help if you need to do totals, etc. <p>Malcolm Wynden<br><a href=mailto:wynden@island.dot.net>wynden@island.dot.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top