【问题标题】:Crystal Report formula if-else statement Date condition水晶报表公式 if-else 语句 日期条件
【发布时间】:2015-06-04 16:48:47
【问题描述】:

请问水晶报表公式中if-else语句如何使用。

我想要类似的东西

If Date = "01/01/1900" Then 
//Display "-" 
Else 
//Display Date

但我总是遇到该字段需要数字、货币和日期错误。 我还是水晶报告的新手。希望你们能指导我。 谢谢

【问题讨论】:

    标签: crystal-reports formula


    【解决方案1】:

    试试

    if  totext((Date(Year(YourDateField), Month(YourDateField), Day(YourDateField))),'dd/MM/yyyy') ="01/01/1900" then
    "-" 
    else 
    totext((Date(Year(YourDateField), Month(YourDateField), Day(YourDateField))),'dd/MM/yyyy')
    

    【讨论】:

    • 谢谢!为什么需要使用 ToText??
    • 因为在整个公式中必须使用相同类型的数据,所以如果要在“then”和“else”之后使用文本,则必须在条件中也使用文本
    猜你喜欢
    • 1970-01-01
    • 2021-09-04
    • 1970-01-01
    • 2017-11-23
    • 1970-01-01
    • 2010-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多