Crystal Report: ¿cómo verificar si una cadena está en una entrada en una matriz?

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] ) 
(CStr({FournirRapportR39.IdNatureProduit}) in {?dlcNatureProduit}[3 to 4])

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

Gracias por tu ayuda.

preguntado el 17 de mayo de 13 a las 08:05

1 Respuestas

//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

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

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

contestado el 17 de mayo de 13 a las 12:05

Thanks for your answer. I done something similar that I put in a custom function and it's working as well. - Arnaud Bessem

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.