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

Creating an array in Crystal Reports

Status
Not open for further replies.

AllpayRog

Technical User
Nov 10, 2008
17
GB
Hi,

I have been trying to create an array in Crystal Reports (XI).

I have a single table with a column containing codes.

All I want to do is create an array in Crystal to hold the codes contained in the table. There are approx 2000.

Can anyone tell me the code?

Best Regards

rpecan
 

I believe the maximum number of elements in an array is 1000. If you describe what you need to do, I suspect there is a better solution.

 
Thanks Brian,

Yes you are right...I have just discovered that the max number in an array is 1000 so really it's a no-goer anyway.

I was trying to come up with a solution to speed up a report linking two massive tables (90 million records in each approx). I thought perhaps to filter one separately and store the required results in an array, and then apply that array as a filter to the second table. It was just a thought but I then got embroiled in trying to get records into an array and it became a sort of challenge. The code I am using is as follows (I've put in a filter to stop adding records when the 1000 limit is reached).

However it doesn't work. The counter part seems to stay on 1.

//In the Header
Global Stringvar Array Codes := MakeArray (" ");
Global Numbervar Counter := 1;
""

//in the detail band
Global Numbervar Counter;
If Counter <= 999 Then
(Global Stringvar Array Codes;
(Codes[counter] := {Table.CODE};
Counter := Counter + 1;
Redim Preserve Codes [counter];
Codes[counter -1]))

//In the footer
Global Stringvar Array Codes;
Global Numbervar counter;
Join(Codes)

nothing shows....


Sorry for the amature code writing...I'm new at this.

Don't spend much time on this...as I say it's more of a challenge really.

Best regards Brian

Roger
 
Hi,
If you link the 2 tables by fields that only return a subset of records from the left-most ( the driving) table based on your selection criteria, the only records returned from the right-hand table will be those that match the limited values from the left-hand one. If you insure that both tables are properly indexed and that the limiting fields are part of the indexes, the speed should be optimized.

Can you post the SQL code produced ( BTW, what database and connectiopn method are you using?)



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi,
In addition to my previous post, review the info here:

faq767-3825

to insure that you are passing as much of the selection work to the database.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks Turkbear,

That is good advice and I'll follow it up.

Best Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top