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

Array Troubles Can Any Crystal Gurus help?

Status
Not open for further replies.

QABrian

Technical User
Apr 15, 2010
10
US
I have a list of 1,174 part numbers in an Access table. I need to convert the column of numbers to a row and format them to be used as a filter in Crystal Reports 2008.

From:
123
456
789

To:
"123", "456", "789"

I understand that Crystal has a limit of 1000 items and I have 1,174. I don't understand arrays much at all, I have spent the last 6 hours working on an array formula I found online for breaking an array up into two arrays then combining them in the report footer.


The site has "totext(<field name>,"####")" in the formula for some reason, I took totext and "####" out because it was giving me an error message. "Too many arguments have been given to this function "####".


Here is my formula:

FORMULA for PNs detail row Test

Whileprintingrecords;

StringVar Array arrcount1;
StringVar Array arrcount2;

NumberVar i;

redim preserve arrcount2[distinctcount({AMT_Part_Numbers.AMT Part Numbers})-1000];
redim preserve arrcount1[1000];

i:=i+1;

if i<=1000 then arrcount1:=({AMT_Part_Numbers.AMT Part Numbers}) else arrcount2:=({AMT_Part_Numbers.AMT Part Numbers});

It accepts that formula.


When I run the report I get the following error regarding the formula:

"A subscript must be between 1 and the size of the array"
It highlights "else [highlight #FCE94F]arrcount2:={AMT_Part_Numbers.AMT Part Numbers}[/highlight];"

I cannot figure out how to get past this.


For reference here is the formula I'm using to display the arrays in the footer.

FORMULA for report footer to display PNs Test

Whileprintingrecords;
StringVar Array arrcount1;
StringVar Array arrcount2;


join(arrcount1[1 to DistinctCount({AMT_Part_Numbers.AMT Part Numbers})],",")+" , "+join(arrcount2[1 to DistinctCount({AMT_Part_Numbers.AMT Part Numbers})],",");

I don't know if I will have any problems with this if I can get beyond the errors in the first formula.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top