在小数点后隐藏零

编程入门 行业动态 更新时间:2024-10-24 08:21:58
本文介绍了在小数点后隐藏零-在快速报表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

朋友. table1有一个字段:Numeric(18,2) 但在fastreport中:在小数点图标旁边显示零 例如: 2>> 2.00 3.5>> 3.50 我想隐藏零 什么是解决方案? 例如: 2>> 2. 3.5>> 3.5 在字段的属性中选择:隐藏零= true 但是没有效果 什么是解决方案? :)

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? :)

推荐答案

让我们说您有一个像这样的表: Lets say you have a table like this: CREATE TABLE [dbo].[Table_1] ( [test] [numeric](18, 2) NULL ) ON [PRIMARY]

下面的查询应为您提供所需的结果:

The query below should give you results like you want:

SELECT Test, CASE WHEN (Test % 1) > 0 THEN CAST(Test AS FLOAT) ELSE (CAST(Test AS INT)) END AS Output FROM Table_1

即使您可以部分格式化SQL语句中的数据,我还是建议对其进行格式化那个报告. 您是否尝试使用%g作为格式.从内联格式 [ ^ ] 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[^]

更多推荐

在小数点后隐藏零

本文发布于:2023-10-14 22:29:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1492405.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:小数点

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!