1

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.

3
  • what is it that you would like to do when it comes to report and the usage of the array? Jun 21, 2009 at 0:02
  • 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? Jun 21, 2009 at 0:03
  • I am not sure of recent CR versions. But, if you can use VBScript - you can do anything that vbscript supports. Jun 21, 2009 at 0:07

3 Answers 3

5

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

0
3

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;
0

While the links provided by shahkalpesh are really useful (especially that powerpoint he references) - there is one other resource worth mentioning here (it was right under my nose): The help file that comes with the crystal reports application.

It is an excellent resource on both the basic syntax and the crystal syntax for the formula language within crystal reports.

1
  • yes, just put the cursor on any keyword and hit the "?" help button.
    – dotjoe
    Jun 22, 2009 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.