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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula can't see Global Variables

Status
Not open for further replies.

jefegrande

Programmer
Apr 3, 2006
4
US
I have a formula field with the following code:

Global stringVar Array myArray := ["Jim","Hans","Jacques","Hitomi","Bob"];
myArray[5];

It's output is fine.

I have a second formula with the following code:

Join(myArray);

When I attempt to use the second formula field I get an error that says

"The ) is missing".

The only thing that I can think of is that the second formula is not seeing the Global Variable.
The first formula is used in the report before the second.
Any ideas are greatly appreciated.

Thanks.
 
I believe you need to declare your variable in the formula before you can use it.
 
Has nothing to do with global, and you don't need to specify global, that's the default.

Join requires a delimiter as part of the function, so try:

whileprintingrecords;
stringVar Array myArray := ["Jim","Hans","Jacques","Hitomi","Bob"];
Join(myArray,",");

Or for a carriage return seperated value use:

whileprintingrecords;
stringVar Array myArray := ["Jim","Hans","Jacques","Hitomi","Bob"];
Join(myArray,chr(13));

The latter would require that you set CAN GROW on for the formula.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top