Quantcast
Channel: SCN : Unanswered Discussions - SAP Crystal Reports
Viewing all articles
Browse latest Browse all 4814

A loop was evaluated more than the maximum number of times allowed - Report Custom Function

$
0
0

 

Hi everyone,

 

I am stuck on trying to figure out why this is happening.

 

I have a report custom function RemoveMisc. Essentially what it does is it extracts every number, letter or space [ ] from a string.

 

My only issue is, is that when I use a small dataset there is no error.

 

However, when I increase my dataset (possibly to the 10,000's) I get the error above.

This loop should only occurs 21 times as the length of the string is 21.

 

Are the number of stacks on the for loop shared throughout all the fields that use this formula?

 

Is there a way to force garbage cleanup so that this can be avoided?

 

Below is the code minus my debugging code.

---------------------------------------------

Function (stringvar str)

 

local stringvar Output;

local numbervar i;

 

str := replaceall(str," ,[]()/");

 

if str <> "" then(

    for i := 1 to len(str) do(

        if asc(ucase(mid(str,i,1))) in 065 to 090

            or asc(ucase(mid(str,i,1))) = 032

            or asc(ucase(mid(str,i,1))) in 048 to 057 then

            Output := Output + ucase(mid(str,i,1));

    );

);

 

Output := trim(Output);

 

if len(Output) < 2 then

    Output := "NULL";

 

    Output;

 

Thanks!

-Antonio


Viewing all articles
Browse latest Browse all 4814


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>