簡體   English   中英

我需要掩蓋或抑制水晶報表中是否為null

[英]I need to mask or suppress if null in crystal reports

尋求Crystal Reports幫助! Crystal Reports 2013 SP5 V14.1.5.1501 Windows 7專業版環境。

我有table.date_field,它是一個日期字段,格式為:xx / xx / xxxx。 我將其放在將以.csv格式導出的報告中,因此該字段必須為10個空格,如果table.date_field中有日期,則該字段可以正常工作。

如果table.date_field為null,則返回;; (.rpt必須用分號分隔)。

我嘗試創建2個公式,一個叫做@date_field_format,另一個叫做@date_field_tweak。

@date_field_format具有以下公式:

picture({table.date_field},'xx/xx/xxxx')  

@date_field_tweak具有以下公式:

if isnull ({@date_field_format}) then
    space(10)
else
    left(trim(totext({@date_field_format}))+space(10),10) 

在.rpt上使用@date_field_tweak返回: ;2//21//201;

如果table.date.field為null,則如何在格式為xx / xx / xxxx的報表中獲取table.date_field並在其中插入10個空格代替日期,對此有何建議?

嘗試這個:

假設您的數據庫日期格式為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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM