Learn how to a build a cloud-first strategyRegister Now


how to initialize an array

Posted on 2005-04-06
Medium Priority
Last Modified: 2008-02-26
hi experts,

i am maintaining an existing report and it has a formula with the ff code:

stringvar array FirstArray :=  ["", "", "", "", "", "", "", "", "", ""]

and it is doing it for an array with size 300.  the size has been increased now.  is there a way to change the code so that i can just specify the number, for example:

stringvar array FirstArray :=  [1000]

the above code is not working and i can't find anything over the net.  just thought that someone here might have an idea on how it can be done.


Question by:wala_lang
  • 3
  • 2
LVL 101

Expert Comment

ID: 13723951
In looking through CR7 help, I don't find any way to declare an array except as you are doing it.

>> is there a way to change the code so that i can just specify the number, for example:
stringvar array FirstArray :=  [1000]

Are you trying to declare an array of 1000 elements?  You may be able to use something like

stringvar array FirstArray [1 to 1000] := " ";


Author Comment

ID: 13724472
yes, its 1000 elements.  i'm gonna give it a try.

Author Comment

ID: 13724483
i change the code of my formula to this:

stringvar array FirstArray[1 to 1000] := "";
numbervar counter:=0  

and i'm getting the error message:

The remaining text does not appear to be part of the formula on the last line.

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

LVL 19

Accepted Solution

GJParker earned 80 total points
ID: 13724866
stringvar array FirstArray;
Redim FirstArray [1000];

The Redim function can be used to set the number of elements in the array. It can also be used to change the number of elements in an array at any time, but this must be done with care. Redim when used by itself will always create an empty array. This means you will lose stored items when you change the size of an array. If you need to Redim an array and maintain the existing valuies, then you use the operator "Redim Preserve" instead. This will resize the array, but keep the exsting values.

Redim Preserve FirstArray [1000]

you should also be aware that 1000 is the maximum number of values an array can hold.

Hope this helps


Author Comment

ID: 13731758
it worked!  thanks gary.

LVL 19

Expert Comment

ID: 13734024
Glad I could help


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question