Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ReDim an Array

Status
Not open for further replies.

Torp23

Programmer
Jun 13, 2002
32
0
0
US
Simplest thing and can't get it to work.
This doesn't work:
WhilePrintingRecords;
numbervar PlanCounter;
Global numbervar array PlanTotalArray;
Redim PlanTotalArray[PlanCounter];

This DOES work (but of course the project won't work this way):
WhilePrintingRecords;
numbervar PlanCounter;
Global numbervar array PlanTotalArray;
Redim PlanTotalArray[1];

[[I am sure there is a number in the PlanCounter variable as I am checking it before the code that runs. I am running the CR that is embeded in Visual Studio 9.0. PlanCounter is a Global variable in another formula, but I ran tests and I know it is populating correctly in this formula.]]
How can I set my array dimension using a numeric variable?

Scott

 
If you have declared as Global number else where try declaring as Global in your formula.

In your example Crystal may be treating as Local numbervar and thus does not know the vars are the same.

Ian
 
Thank you for your response.
Eventually I will want to report the PlanTotalArray in another section, but at the moment I am not doing anything wtih the array outside of this function. Even though making it global should be irrelevant in this case, I changed it anyway and it still did not work:

WhilePrintingRecords;
Global numbervar PlanCounter;
Global numbervar array PlanTotalArray;
Redim PlanTotalArray[PlanCounter];
PlanTotalArray[PlanCounter]:={@ItemNumberResetCountDetails};
PlanCounter;

When I say that "it did not work", I mean that the program runs about the same amount of time, but no CR files are created. The workstation is making 'noise' like it is working on the building of the output, but then it finishes and no files are produced.

I feel there is something I am not doing in regards to the PlanCounter variable to make it recognized by the REDIM statement. Can anyone tell me what I am doing wrong? Thanks,
-Scott
 
I figured it out. I had to set the variable to a value before the code above ran. It must default to a null or something and that froze up the report. When I moved the function that instantiated the variable to the header, the code ran fine.

Thank you for your time on considering this problem.

Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top