简体   繁体   English

将Crystal Formula Workshop转换为SQL和SSRS

[英]Convert Crystal Formula Workshop to SQL & SSRS

On my first time trying to re-create reports in SSRS taking Crystal Reports, I've been stuck in one Formula to place it in SSRS. 在我第一次尝试使用Crystal Reports在SSRS中重新创建报告时,我被困在一个公式中以将其放置在SSRS中。

So, how can I convert this crystal-query-formula to a SQL query ? 那么,如何将这个crystal-query-formula转换为SQL query呢?

 StringVar DorF:='D';

 if {TABLE.COUNTRY_COLUMN} = 'US' then DorF := 'D';
 if {TABLE.COUNTRY_COLUMN} <> 'US' and not ISNULL 
 ({TABLE.COUNTRY_COLUMN}) then DorF := 'F';
 DorF "

It's been a while since I used Crystal reports but this looks like it can just be a CASE statement in a query. 自从我使用Crystal报表以来已经有一段时间了,但是看起来它只是查询中的CASE语句。 I'm not sure about the ELSE though - I think it would be DorF which is originally D . 我不确定ELSE,但我想应该是最初是D的 DorF

CASE WHEN COUNTRY_COLUMN = 'US' THEN 'D' 
     WHEN COUNTRY_COLUMN <> 'US' AND COUNTRY_COLUMN IS NOT NULL THEN 'F' 
     ELSE 'D' --??
END

If you wanted to do it in SSRS in the report instead of the query, I would use nested IIF statements. 如果您想在报告的SSRS中而不是查询中执行此操作,则可以使用嵌套的IIF语句。

IIF(Fields!COUNTRY_COLUMN.Value = 'US', "D", 
    IIF(Fields!COUNTRY_COLUMN.Value <> 'US' AND NOT ISNOTHING(Fields!COUNTRY_COLUMN.Value), "F", "D")

This reads as IF country = US then D else if country <> US and NOT NULL then F else D. 读为: IF country = US then D else if country <> US and NOT NULL then F else D.IF country = US then D else if country <> US and NOT NULL then F else D.

I'm guessing that the field can just be F oreign or D omestic and no other values. 我猜测该字段只能是FD波斯语,而没有其他值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM