Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi friends.

table1 have a field : Numeric(18,2)

but in fastreport: show zero next the decimal icon
for example:
2 >> 2.00
3.5 >> 3.50

i want to hide zero
what is solution??
for example:
2 >> 2.
3.5 >> 3.5

in properties of field is select : hide zero = true
But had no effect
what is solution?
:)
Posted
Updated 19-May-12 23:53pm
v2
Comments
OriginalGriff 20-May-12 5:58am    
Don't repost your question to add more information - use the "Improve question" widget to edit your question and provide better information instead.
I have deleted the older question.
faezun 20-May-12 6:35am    
it is 2 question : hide zero
1- in sql
2- in fastreport
Please return it
Maciej Los 20-May-12 6:18am    
Fast report - what's that?
faezun 20-May-12 6:37am    
a report like: crystall report , microsoft report , ...

Lets say you have a table like this:


SQL
CREATE TABLE [dbo].[Table_1]
(
    [test] [numeric](18, 2) NULL
) ON [PRIMARY]  


The query below should give you results like you want:

SQL
SELECT
    Test,
    CASE WHEN (Test % 1) > 0 THEN CAST(Test AS FLOAT) ELSE (CAST(Test AS INT)) END AS Output
FROM Table_1
 
Share this answer
 
Comments
faezun 20-May-12 6:37am    
thanks,
:):):)
Wendelius 20-May-12 7:14am    
Nice :) Even though the float version would still "return" all the trailing zeroes in the data to the client. What I mean is that 3.5 may still be formatted 3.50 by the tool :)
Even though you can partially format the data in the SQL statement I would advice to format it on the report.

Have you tried using %g as the format. Picked up this from Inline formatting[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900