Problems with @for

Hi,

I posted an question yesterday about @subset, and thought overnight about replacing it, even simplifying it, using an @for loop. Yet again, strange problems I just can’t figure out.

Below is my code

s_1 := @TextToNumber(@Text(Start));

s := @If(@IsError(s_1); 1 ; s_1= 0; 1; s_1);

c_1 := @TextToNumber(@Text(Count));

c := @If(@IsError(c_1); 1; c_1 = 0; 1; c_1);

h := @TextToNumber(@Text(TotalHits));

pages := @If(c = 0; 1; @If(@Integer(h/c)<(h/c); @Integer(h/c)+1; @Integer(h/c)));

curpage := @If(c = 0; 1; @Integer(s/c) = 0; 1; @Integer(s/c) < (s/c); @Integer(s/c) + 1; @Integer(s/c));

tmp:=pages;

x:=1;

@For(x:=1;x<=tmp;x:=x+1;

html:=html+@ReplaceSubstring(nhtml[x];"***";@Text(x))

);

html+" "+@Text(tmp)

This code is to display how many pages there are in search results, h is the total amount of results returned and c is the number of results to display on each pages.

Now, if I replace the x<=tmp with the x<=3 or even make tmp:=3; (which it computes to in my example), it works fine BUT if I use the pages variable, it seems if the @for loop goes into an infinite loop - I get the error in the browser

Error 500

HTTP Web Server: Lotus Notes Exception - The formula has exceeded the maximum allowable memory usage.

I’m going nuts here, please can someone suggest something.

Thanks,

Cameron

Subject: Do you have a Field called “pages” on your Form? If you change the name of the var to “pg1” or something does it still fail?