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

How to override the default number format in crystal 1

Status
Not open for further replies.

CrystalUser1

Programmer
Sep 16, 2004
138
US
Hi,

I have a summarized number field in cross tab. In order to display nulls as zeros and also to have the format depending on the field type, i have created a formula and using that formula as summarized field.

if isnull({employee.salary}) then 0

else
if {employee.type} ="manager" then
truncate({employee.salary})

else if {employee.type} ="employee" then

truncate({employee.salary},1)

I used kind of formatting using truncate etc., in the above formula. but because its a number field, the default number format of the crystal is overriding the above format.

How to not use the default number format in the crystal. I want to use the format that I used above.

Please help.

thanks in advance.
 
So you must have either a row or a column based on employee type, right?

Right click on the summary in the crosstab->format field->number->customize->decimals->x+2 and enter:

if gridrowcolumnvalue("employee.type") = "manager" then 0 else 1

Between the quotes in gridrowcolumnvalue("") you would place the exact name of your employee type table.field without the curly brackets.

-LB
 
Thank you lbass,

my cross tab data looks (should)like this: right now its not looking like this: its displaying either with decimals or with no decimals for mgr and emp.

division1 division2

2001 2002 2001 2002

mgr emp mgr emp mgr emp mgr emp

VA 200 99.1 100 98.1 100 99.9 100 87.1
MD 123 56.7 123 78.1 120 56.7 134 90.1


the first column is division, second is year and the third is type which is manager or employee.

row is state.


the data in the DATABASE VIEW looks like this: total_count is the field which already counted the rows according to some condition in the view.

division_name year employee_type state Total_Count

division1 2001 manager VA 200
division1 2001 manager MD 123
division1 2002 employee VA 99.1
division1 2002 employee VA 56.7 etc.,

When I did the same thing as you said, I am getting the following message:

"This is not the name of a grid group for the field being formatted".

Thanks
 
What is the exact field name for employee_type when you add it to the report? It would look something like {table.employee_type}. Please provide that and also provide the exact formatting formula you used.

-LB
 
the exact field name is: employee_type

yes, it is {employee.employee_type}. the following is the formatting formua I used:

if gridrowcolumnvalue("employee.employee_type") then 0 else 1

thanks
 
The formula should be:

if gridrowcolumnvalue("employee.employee_type") = "manager" then 0 else 1

If this still doesn't work, then go to the customize style tab in the crosstab expert and highlight the employee.employee_type column field and observe what is in the "alias for formulas" box. Whatever is in that box should be what you use between the parens in the formatting formula.

-LB
 
i GOT IT, thank you so much, I cant tell you LB how much I am happy with your help.

Thank you very much. you are really really great.

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top