How does one manipulate arrays in crystal reports X?

20,064

Solution 1

See if this link helps - http://www.scribd.com/doc/6998296/Basic-vs-Crystal-Syntax

In VBScript, you could do this

1) dim tenItems(0 to 9)
2) redim preserve tenItems(0 to 12) - not sure if this will work in CR basic syntax.
3) Ubound(tenItems) - gives you the upper bound of the array - check for the correct syntax.
4) You will have to write code to do that. I don't think VB supports array of that kind. I am not sure of CR formulas for array manipulation.
5) No idea of that.

EDIT: Here is 1 more link (crystal syntax).
http://sfarea.org/JLum1105.ppt

Solution 2

crystal-reports syntax:

1) create an array with a fixed number (say 10) of elements

//arrays in Crystal Reports are 1-based.  1000 elements maximum
Stringvar Array myArray[10];

2) create a dynamic array (whose size expands as needed)

Redim Preserve myArray[Ubound(myArray)+1];
myArray[Ubound(myArray)]:="x";

3) get the size of the dynamic array

Ubound(myArray);

4) add and remove elements from the middle, beginning, and end of an array You will need to manually manipulate the array.

5) empty an array

Stringvar Array empty;
myArray:=empty;
Share:
20,064
Faisal Vali
Author by

Faisal Vali

Updated on October 23, 2020

Comments

  • Faisal Vali
    Faisal Vali over 3 years

    I was reading "Crystal Reports X - The complete reference" by G. Peck for a project at work, and I was wondering how one manipulates arrays in a Crystal Reports formula. I could not find the answer easily in the book.

    For instance - how do I do any/all of the following:

    -) create an array with a fixed number (say 10) of elements
    -) create a dynamic array (whose size expands as needed)
    -) get the size of the dynamic array
    -) add and remove elements from the middle, beginning, and end of an array
    -) empty an array

    What is the most comprehensive resource/book for learning the Crystal Formula language syntax?

    Thank you for any help you can provide.

    • shahkalpesh
      shahkalpesh almost 15 years
      what is it that you would like to do when it comes to report and the usage of the array?
    • Faisal Vali
      Faisal Vali almost 15 years
      I am just exploring the crystal formula language - i might not need arrays to do what i want - but was wondering how expressive this language really is?
    • shahkalpesh
      shahkalpesh almost 15 years
      I am not sure of recent CR versions. But, if you can use VBScript - you can do anything that vbscript supports.
  • dotjoe
    dotjoe almost 15 years
    yes, just put the cursor on any keyword and hit the "?" help button.