Problems ordering with @sort

Hi, I create a dynamic query using @dblookup and some fields. I added the option for resort the values returned by the @dblookup using @sort command. It works OK except when the query retuns a lot equal values ( I think), the server show this error:

18/04/2004 10:21:23 a.m. HTTP Web Server: Lotus Notes Exception - The formula has exceeded the maximum allowable memory usage.

The view used contain the following fields:

Serie

Hostname

Interface

Type

Boot

Status

Descripcion

when I select the order by Status or Boot I get the error, but with the other fields not.

18/04/2004 10:21:23 a.m. HTTP Web Server: Lotus Notes Exception - The formula has exceeded the maximum allowable memory usage.

This is the command for sort:

Lista := @If(Indice = 1;Lista;@Sort(Lista;[CustomSort];

@If(@Transform( $A ; “Cadena”; @Subset(@Subset(@Explode(Cadena;“|”);Indice);-1) ) >

       @Transform( $B ; "Cadena"; @Subset(@Subset(@Explode(Cadena;"|");Indice);-1) );1;

       0 )));

The field returned from the view has multiple values using “|” as separator.

could anyone help me ?

Subject: I do not think you need the @Transform at all.

$A and $B are already just 1 element of the Lista that you are sorting. The Idea being that your comparison returns -1, 0, or 1 based on Less Than, Equal To or Greater Than. An example from the help:@Sort(movies;[CASESENSITIVE]:[CUSTOMSORT];@If(@Length($A) < @Length($B);-1;@Length($A) > @Length($B);1;0))

So probably what you want is:

Lista := @If(Indice = 1;Lista;@Sort(Lista;[CustomSort];

@If(@Subset(@Subset(@Explode($A ;“|”); Indice);-1) > @Subset(@Subset(@Explode($B;“|”);Indice);-1); 1;

       @Subset(@Subset(@Explode($A ;"|"); Indice);-1) < @Subset(@Subset(@Explode($B;"|");Indice);-1); -1;

       0)));