Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

formula to round number

Posted on 2006-10-26
12
Medium Priority
?
745 Views
Last Modified: 2012-05-05
Hi
 I am using the following to convert to get rounded numbers in my stored procedure. How can I do the same in crystal report editor and what is the formula for the same. How do you get to the editor

convert(int, round(convert(float,@number)/1000, 0)
0
Comment
Question by:PNKJ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
12 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 17812971
Hi PNKJ,
On the face of it, all you need is a formula field with:

Round(@number/1000,0)

Pete
0
 

Author Comment

by:PNKJ
ID: 17812997
Thanks but where do you write this formula I am trying to click on the column field and format not sure if i am right
0
 
LVL 77

Accepted Solution

by:
peter57r earned 1000 total points
ID: 17813094
You have to create a new Formula Field in the field explorer.

When you have done that you drag the formula field into the report.

Pete
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 101

Expert Comment

by:mlmcc
ID: 17813146
A little help with creating a formula

Display the field insertion popup
Click the FORMULA Tab
Click NEW (may have to right click)
Name - MyRoundedNumber
Formula
As Above

Click SAVE
Close the formula editor

Drag the formula onto the report and delete your other field

mlmcc
0
 

Author Comment

by:PNKJ
ID: 17813196
Whenever i try to save it says ) is missing there is error in formula i wen tto feild explorer right click formula fields
Selected new gave the name and the formula editor opened .
I typed Round(@number/1000,0)
when trying to save it gices error ) is missing
0
 
LVL 77

Expert Comment

by:peter57r
ID: 17813227
What is @number?
0
 

Author Comment

by:PNKJ
ID: 17813263
From data table i have meatproducts, groceries etc these are the colomn names and are returned as such from database for eg datatable_meatproducts
0
 

Author Comment

by:PNKJ
ID: 17813790
I wrote this in formula editor and i get error boolean is required
If {datatable.section} = 1 or Trim({data_table.section_name}) = "yearly report" then
Round({datatable.meatproducts}/1000,0)and
Round({datatable.vegetables}/1000,0)
0
 
LVL 13

Expert Comment

by:crgary_tx
ID: 17813944
it is 'and' or 'else you are using in the formula? Replace 'and' with 'else' if you are using 'and' in the formula

Gary
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 1000 total points
ID: 17814011
If @number is another formula it needs to be in { }

IN your record do you have several numeric values you want rounded?  If so you will need to have a formula for each

For example to get the meat products
If {datatable.section} = 1 or Trim({data_table.section_name}) = "yearly report" then
   Round({datatable.meatproducts}/1000,0)
else
   {datatable.meatproducts}            

for the else part use whatever value you need if it isn't section 1 or the yearly report

mlmcc
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question