Crystal Report-如何检查字符串是否在数组的条目中? [英] Crystal Report - How check if a string is in a entry on a array?

查看:92
本文介绍了Crystal Report-如何检查字符串是否在数组的条目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个条件,以查找数组的每个元素,如果当前元素(字符串)具有特定字符,则条件返回true。
更多详细信息:
如果满足以下条件,则条件必须为true:
-第一个字符为1,第三个字符在IdList中
-第一个字符为0,第三个字符为另一个IdList

I would like to make a condition that look each element of a array and if the current element (string) possess a specific charactere, the condition return true. More details: The condition must be true if: - The first charactere is 1 and the third is in a IdList - The first charactere is 0 and the third is in a other IdList

我尝试这样做,但是没有用:

I've try to do this, but it didn't work:

("1;" in {?dlcNatureProduit}[1 to 2] and {FournirRapportR39.NatureProduitType} in {?dlcNatureProduit}[3 to 4] ) 
OR
(CStr({FournirRapportR39.IdNatureProduit}) in {?dlcNatureProduit}[3 to 4])

数组外观像这样:
1; 1
0; 2
0; 3
1; 3
1; 4
1; 5
0 ; 6
...

The array look like this: 1;1 0;2 0;3 1;3 1;4 1;5 0;6 ...

感谢您的帮助。

推荐答案

//create an array; split into tokens on ";"
Stringvar Array foo := Split(1;1 0;2 0;3 1;3 1;4 1;5 0;6, ";");

Numbervar i;

// examine all elements in the array
For i:=0 To Ubound(Foo) Do (

  // create second array base on first; split on " "
  Stringvar Bar := Split(Foo[i]," ");

  // first test
  If ToNumber(Bar[1])=1 And ToNumber([2])=[] Then
    //whatever

  ElseIf ToNumber(Bar[1])=1 And ToNumber([2])=[] Then
    // whatever

  ; // semi-colon might be required; doing this code from memory
)

这篇关于Crystal Report-如何检查字符串是否在数组的条目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆