Skip to Content
0
Former Member
Apr 27, 2009 at 10:41 PM

Array problem (empty).

321 Views

Hi everybody,

I'm using Crystal X and I have the following query

IdField Field1 Field2

1 CCC 8

1 GGG 3

1 DDD 2

2 AAA 7

I want the following output

IdField

1 CCC GGG DDD Field2 define different format to Field1 (different background color)

2 AAA

My report is grouped by IdField. As the output for Field1 has a different format depending on Field2. I want to write the Field1+Field2 values for each IdField in an Array, I have the following formulas, but the array looks empty, I have changed the array declaration as global and still is empty

Section: ReportHeader

Formula InitArray

shared stringvar Array DataArray;

redim DataArray[30];

Section: Details (Suppresed)

Formula AddDataToArray

shared numbervar iCounter;

shared stringvar Array DataArray;

iCounter := iCounter + 1;

DataArray[iCounter] := {Command.Field1} + "-" + {Command.Field2};

Section: Footer Group1a

Formulla FillTextFromArray

shared numbervar sDataVal;

shared stringvar Array DataArray;

sDataVal := DataArray[1]; //DataArray[1] shoud be = "CCC-8"

left(sDataVal, len(sDataVal)-2);

{@DisplayData1}= DataArray[1]; //This is my problem the array is empty

Section: Footer Group1b

Display the following data

IdField @DisplayData1 @DisplayData2 @DisplayData3 ...

I added 50 formulas to display each Field1 value with different formats. I know these columns are fixed, but I coudn't find any other way.

I have 3 question:

??? What is wrong on my array than in formula "FillTextFromArray" is empty???

??? Is there another way to refence a formula or a text object different than FormulaName or TextObjectName???, like an object array or something, because I will be dealing with 50 formulas to write the value and to change the format

??? How to make reference to a text object, in case I would change the 50 formulas by 50 text objects

Please help with any of the 3 questions or any ideas to make the report

thanks

cc