简体   繁体   English

Crystal Reports v14找不到所有空值

[英]Crystal Reports v14 not finding all null values

Alright, I've run into this before and have gotten everything to work correctly in the past. 好吧,我以前曾碰到过这个问题,过去已经使所有事情都能正常工作。 I have an SQL code that was created that now needs to be turned into a crystal report. 我有一个已创建的SQL代码,现在需要将其转换为水晶报表。 The SQL shows 956 lines, but Crystal is only showing 886. SQL显示956行,但是Crystal仅显示886行。
Here is the SQL code: 这是SQL代码:

SELECT 
I4240,
I4201,
I4202,
I4203,
I4204,
I4206,
I4213,
I4214,
I4225,
I4208,
I4299 
FROM 
    MT.INVENTORY
WHERE
(
    I4202 IN ('UNKNONWN','VERIFY MFR','OTHER','VARIOUS','TBD','NA','N/A') OR
    (
        I4203 IN ('UNKNONWN','VERIFY MODEL NUMBER','OTHER','VARIOUS','TBD','NA','N/A','MISCELLANEOUS') 
        OR I4203 IS NULL 
        OR LENGTH(I4203)=0
    ) OR
    (
        I4204 IN ('UNKNOWN DESCRIPTION','VERIFY DESCRIPTION','OTHER','VARIOUS','TBD','NONE - NO STD USED','NA','N/A','MISCELLANEOUS') 
        OR I4204 IS NULL 
        OR LENGTH(I4204)=0
    ) 
) AND
I4240 NOT IN ('MT','STD','NESD')

ORDER BY I4240,I4202,I4203,I4204

and the record selection formula from CR: 和来自CR的记录选择公式:

(
    {Inventory.I4240} <> 'mt' and
    {Inventory.I4240} <> 'std' and
    {Inventory.I4240} <> 'nesd'
) 
AND
(
    (
        {Inventory.I4202} = 'UNKNONWN' OR
        {Inventory.I4202} = 'VERIFY MFR' OR
        {Inventory.I4202} = 'OTHER' OR
        {Inventory.I4202} = 'VARIOUS' OR
        {Inventory.I4202} = 'TBD' OR
        {Inventory.I4202} = 'NA' OR
        {Inventory.I4202} = 'N/A'
    )
    OR
    (
        {Inventory.I4203} = 'UNKNONWN' OR
        {Inventory.I4203} = 'VERIFY MODEL NUMBER' OR
        {Inventory.I4203} = 'OTHER' OR
        {Inventory.I4203} = 'VARIOUS' OR
        {Inventory.I4203} = 'TBD' OR
        {Inventory.I4203} = 'NA' OR
        {Inventory.I4203} = 'N/A' OR
        {Inventory.I4203} = 'MISCELLANEOUS' OR
        ISNULL({Inventory.I4203}) OR
        LENGTH(trim({Inventory.I4203})) < 1 OR
        INSTR(trim({Inventory.I4203}), "") = 0 OR
        TRIM({Inventory.I4203}) = ""
    )
    OR
    (
        {Inventory.I4204} = 'UNKNOWN DESCRIPTION' OR
        {Inventory.I4204} = 'VERIFY DESCRIPTION' OR
        {Inventory.I4204} = 'OTHER' OR
        {Inventory.I4204} = 'VARIOUS' OR
        {Inventory.I4204} = 'TBD' OR
        {Inventory.I4204} = 'NONE - NO STD USED' OR
        {Inventory.I4204} = 'NA' OR
        {Inventory.I4204} = 'N/A' OR
        {Inventory.I4204} = 'MISCELLANEOUS' OR
        ISNULL({Inventory.I4204}) OR
        LENGTH(trim({Inventory.I4204})) < 1 OR
        INSTR({Inventory.I4204}, "") = 0 OR
        TRIM({Inventory.I4204}) = ""
    )
)

Any help would be appreciated. 任何帮助,将不胜感激。

In Crystal, if a particular field can be null then you need to check for that condition as the very first thing you do with it, otherwise the entire formula will error out and nothing will be evaluated. 在水晶,如果一个特定字段可以为空,那么你需要检查该条件,你用它做的第一件事,否则整个公式将因错误而没有进行评估。

So in your case, fields I4203 and I4204 need the isnull() check moved to the top of their respective sections at the very least. 因此,在您的情况下,字段I4203和I4204至少需要将notull isnull()检查移到其相应部分的顶部。 If I4240 and I4202 can be null, then you should handle those conditions as well. 如果I4240和I4202可以为空,那么您也应该处理这些条件。

Also, you have a couple references to the word "UNKNONWN"; 另外,您对“ UNKNONWN”一词有一些引用; is that a typo? 那是错字吗?

The issue was that the report options were set to use null as default, but for some reason in the record selection formula it was set to exception. 问题是报告选项设置为默认使用null,但由于记录选择公式中的某些原因,将其设置为exception。 Once that was set to the default setting it worked without any issues and the counts were correct. 将其设置为默认设置后,它可以正常工作,并且计数正确。

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

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