views:

2104

answers:

3

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.

+2  A: 

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

shahkalpesh
Wow man - thanks - those resources are great - *bow*
Faisal Vali
A: 

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.

Faisal Vali
yes, just put the cursor on any keyword and hit the "?" help button.
dotjoe
+1  A: 

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;

Craig