[英]I need to mask or suppress if null in crystal reports
Looking for Crystal Reports help! 寻求Crystal Reports帮助! Crystal Reports 2013 SP5 V14.1.5.1501 Windows 7 pro environment.
Crystal Reports 2013 SP5 V14.1.5.1501 Windows 7专业版环境。
I have table.date_field that is a date field formatted as such: xx/xx/xxxx. 我有table.date_field,它是一个日期字段,格式为:xx / xx / xxxx。 I'm putting it in a report that will be exported as a .csv so the field has to be 10 spaces which works fine if there is a date in table.date_field.
我将其放在将以.csv格式导出的报告中,因此该字段必须为10个空格,如果table.date_field中有日期,则该字段可以正常工作。
If table.date_field is null it returns ;; 如果table.date_field为null,则返回;; (.rpt has to be separated by semicolons).
(.rpt必须用分号分隔)。
I tried creating 2 formulas one I called @date_field_format and one I called @date_field_tweak. 我尝试创建2个公式,一个叫做@date_field_format,另一个叫做@date_field_tweak。
@date_field_format has the following formula: @date_field_format具有以下公式:
picture({table.date_field},'xx/xx/xxxx')
@date_field_tweak has the following formula: @date_field_tweak具有以下公式:
if isnull ({@date_field_format}) then
space(10)
else
left(trim(totext({@date_field_format}))+space(10),10)
Using @date_field_tweak on the .rpt returns: ;2//21//201;
在.rpt上使用@date_field_tweak返回:
;2//21//201;
Any suggestions on how to get table.date_field on a report formatted like this xx/xx/xxxx with 10 spaces inserted in place of the date if table.date.field isnull? 如果table.date.field为null,则如何在格式为xx / xx / xxxx的报表中获取table.date_field并在其中插入10个空格代替日期,对此有何建议?
Try this: 尝试这个:
assuming your date format from database is 29/04/2015
假设您的数据库日期格式为
29/04/2015
if isnull ({Sheet1_.date}) then
space(10)
else
Split(ToText(Cdate({Sheet1_.date})),"/")[1]+"/"+
Split(ToText(Cdate({Sheet1_.date})),"/")[2]+"/"+
Split(ToText(Cdate({Sheet1_.date})),"/")[3]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.