[英]Crystal Reports Selection Formula Crystal Syntax - - value not in a field or value in an array
我希望在我的记录选择中排除,但我的“不在”声明中没有成功。
这个说法有效
and not ({Table.Field} startswith ["ABC","123"]) //works when values start with items in the array
但是这个声明似乎被忽略了,尽管值在字段中
and not ({Table.Field} in ["ABC","123"]) // doesn't work when values are anywhere in the field
此语句也不起作用(没有数组,但值在字段中:
and not ({Table.Field} in "ABC”) // doesn't work either
这些陈述是多项选择和排除的一部分。 有人可以告诉我如何让“不在数组中”选择在 Crystal 语法中工作吗? 我敢肯定这是我一直忽略的非常简单的事情。 文本大写/小写不是问题。
非常感谢。
我认为您正在寻找 InStr function,如果找到,则返回在另一个字符串中找到字符串的位置,否则返回 0。 您的选择公式将如下所示:
Not (InStr({Table.Field}, 'ABC') > 0)
警告:使用 CR 函数进行过滤时,CR 可能无法将过滤委托给 db 后端,这在某些情况下会导致性能下降。
编辑:对数组中的每个字符串执行检查的示例 - 可以在记录选择公式中完成:
StringVar Array stringarray := ["ABC", "123"];
Local NumberVar i;
Local BooleanVar atLeastOneStringFound;
atLeastOneStringFound := false;
For i := 1 To Count(stringarray) Do (
If InStr({Table.Field}, stringarray[i]) > 0
Then atLeastOneStringFound := true;
);
Not atLeastOneStringFound;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.