cancel
Showing results for 
Search instead for 
Did you mean: 

Array or List with infinite (endless) number of elements

Former Member
0 Kudos

Hi,

I've a report wiith a lot of records.

The records are stored in 3 array's.

Sometimes there are more then 3000 records.

i can create another array, but then the limit is 4000.

I can create array's in array's, but then the limit is 1000*1000

Is there something like an endless list or array in crystal?

Or a way to have a numer variable to create array's on demand.

I mean when the numbervar x is 4, then i would create the array

(array & x), so it's array4

When the numbervar x is 5

The same code would create the array array5

Accepted Solutions (1)

Accepted Solutions (1)

former_member292966
Active Contributor
0 Kudos

Hi Joris,

I ran into a similar problem where I could have anywhere from 0 to several thousand records. I finally gave up with the arrays and created a stored procedure that returned the records to me in a temp table and I reported directly off the temp table.

It ran faster and the data was more manageable this way.

Just something to think about.

Good luck,

Brian

Answers (5)

Answers (5)

Former Member
0 Kudos

I am inclinded to agree with Brian. While you could use the method I have specified above it is very inefficient and takes up way too many computer resources. It is far more efficient and faster to develope an SQL query, place that query in Crystal Reports as a command then report from that 'temp' table.

The efficiency of an SQL query far outstripes arrays in Crystal (providing it's not a silly SQL query of course).

Former Member
0 Kudos

Hi Joris, I have recently found myself in the same predicament and it is kind of crappy. I have found the same limitations as you Array Max = 1000, String Max = ~65K characters. Admittedly this is a workaround but I think it is a nice one. What you could do is create sting array and combine the elements using a character separator (e.g. ';'), once the length in each array element reaches a certain size you would then move onto the next array element. I have developed some code in Crystal XI V2 that builds this combined string array, see below. There are however a few things to consider:

Firstly, this will increase processing time.

Secondly this code will increase memory usage.

Thirdly, depending on what you are using it for you would need advanced string analysis and/or data conversion to get the data out.

Lastly this code could potentially store up to 65million characters (1,000 x 65,000).

Hope this helps?

SHARED STRINGVAR ARRAY holdArray_DealRef;

SHARED NUMBERVAR k;

LOCAL STRINGVAR holdString;

/// Only want to hold 'Cheese' deals in string array.

IF LEFT({Table.DealReference}, 6) = 'Cheese' THEN

(

IF k = 0 THEN

(

k := 1; /// Sets k at 1 for the start.

holdString := {Table.DealReference};

Redim Preserve holdArray_DealRef[k];

holdArray_DealRef[k] := holdString;

)

ELSE

(

holdString := holdArray_DealRef[k];

/// The reason that an array is built from concatenated strings is to get around the Crystal limitations.

/// The limit for any array is 1000 items.

/// The limit for any string variable is just over 65,000 characters.

IF LEN(holdString) > 32000 THEN /// This could easily be up to ~65,000 characters.

(

k := k + 1;

Redim Preserve holdArray_DealRef[k];

holdString := {Table.DealReference};

holdArray_DealRef[k] := holdString;

)

ELSE

(

holdString := holdString & ';' & {Table.DealReference};

holdArray_DealRef[k] := holdString;

);

);

);

Former Member
0 Kudos

That's another way to do it, but with that solution you will also have limitations.

I solved it by rebuilding the report without array's, but with some additional sql statements etc.

Thanks for your answer.

Former Member
0 Kudos

The article is clear to me.

It explains the building of dynamic array's.

But in the article they have the same limitations as me.

They create 3 array's and fills them dynamically.

But when there are 3001 records, the record is not added.

The question is when we have item 3001, is there any way to create a new array dymanically to fill with the element 3001 - 4000

something like

if (rtICS > 3000) then numbervar array ( array & (rtICS / 1000) )

So array3 is created

Former Member
0 Kudos

I haven't done previously. I need to go through.

Regards,

Parsa.

Former Member
0 Kudos

I know.

Because of that i said 3000 element for 3 array's.

Anyone have a solution with no limitations or a way to create array's with variable names?

Former Member
0 Kudos

Creating dynamic arrays may help you. Check this link:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/50477290-db1d-2b10-ce9c-a1b38197...

If you open as pdf it won't work. Try to view as Html.

Regards,

Parsa.

Former Member
0 Kudos

As i know , the maximum size of an array is 1000 elements.

Regards,

Parsa.