# Exception in find

**URL:** <https://forum.servoy.com/t/exception-in-find/6546>\
**Category:** Classic Servoy\
**Created:** [October 5, 2006, 5:47pm UTC](https://forum.servoy.com/t/exception-in-find/6546 "2006-10-05T17:47:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbarbal](https://avatars.discourse-cdn.com/v4/letter/c/bb73d2/32.png) [@cbarbal](https://forum.servoy.com/u/cbarbal)\
**Post date:** [October 5, 2006, 5:47pm UTC](https://forum.servoy.com/t/exception-in-find/6546/1 "2006-10-05T17:47:30Z")

</div>

I have a method that in Servoy Developer version 2.5 works correctly and with version 3.0 build 371 it gives the following error:

org.mozilla.javascript.JavaScriptException: Cycle detected, function buscar\_articulo called 22 times

```auto
//Start a find request
controller.find();
nombre = '%'+globals.gText+'%';
controller.search();

globals.gText = ''

//si no hemos encontrado ningun registro
if ( controller.getMaxRecordIndex()==0 )
{
	controller.loadAllRecords()
}

```

Java version 1.5.0\_08-b3 (Windows XP)

Carles Barbal

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [October 6, 2006, 9:45am UTC](https://forum.servoy.com/t/exception-in-find/6546/2 "2006-10-06T09:45:05Z")

</div>

> cbarbal:  
> I have a method that in Servoy Developer version 2.5 works correctly and with version 3.0 build 371 it gives the following error:
> 
> org.mozilla.javascript.JavaScriptException: Cycle detected, function buscar\_articulo called 22 times
> 
> ```auto
> //Start a find request
> 
> ```

controller.find();  
nombre = ‘%’+globals.gText+‘%’;  
controller.search();

globals.gText = ‘’

//si no hemos encontrado ningun registro  
if ( controller.getMaxRecordIndex()==0 )  
{  
controller.loadAllRecords()  
}

> ```auto
> 
> Java version 1.5.0_08-b3 (Windows XP)
> 
> Carles Barbal
> 
> ```

Try to use:

```auto
//Start a find request
controller.find();
nombre = '%'+globals.gText+'%';
var found = controller.search();

globals.gText = null

//si no hemos encontrado ningun registro
if ( found == 0 )
{
	controller.loadAllRecords()
}

```

---

<div class="post-metadata">

**Author:** ![cbarbal](https://avatars.discourse-cdn.com/v4/letter/c/bb73d2/32.png) [@cbarbal](https://forum.servoy.com/u/cbarbal)\
**Post date:** [October 6, 2006, 3:55pm UTC](https://forum.servoy.com/t/exception-in-find/6546/3 "2006-10-06T15:55:05Z")

</div>

Thanks Nicola but does not work.

The method is related to the event onDataChange. In mode debugger I have seen that it executes the method twice, it does not pay attention to the value that it has var found or in controller.getMaxRecordIndex()==0

The first time gives the following error:

org.mozilla.javascript.JavaScriptException: Cycle detected, function buscar\_articulo called 22 times

the second time:

org.mozilla.javascript.JavaScriptException: Cycle detected, function buscar\_articulo called 23 times

Carles Barbal

---

<div class="post-metadata">

**Author:** ![automazione](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@automazione](https://forum.servoy.com/u/automazione)\
**Post date:** [October 6, 2006, 4:53pm UTC](https://forum.servoy.com/t/exception-in-find/6546/4 "2006-10-06T16:53:50Z")

</div>

Hi Carles,

Try to execute your method with a button and not related to the onDataChange and see if it works. You probably have some other event related to the form. Maybe is a good idea to build a single form test solution and see if you can reproduce your problem.

ciao

---

<div class="post-metadata">

**Author:** ![cbarbal](https://avatars.discourse-cdn.com/v4/letter/c/bb73d2/32.png) [@cbarbal](https://forum.servoy.com/u/cbarbal)\
**Post date:** [October 6, 2006, 6:35pm UTC](https://forum.servoy.com/t/exception-in-find/6546/5 "2006-10-06T18:35:00Z")

</div>

Hi Enrico,

With the button it works correctly. But I believe that he is bug, works correctly in record view, list view, but not with table view. I have it in tabpanel that shows one table view.

Felicidades al evangelista.

Carles Barbal

---

<div class="post-metadata">

**Author:** ![automazione](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@automazione](https://forum.servoy.com/u/automazione)\
**Post date:** [October 6, 2006, 7:48pm UTC](https://forum.servoy.com/t/exception-in-find/6546/6 "2006-10-06T19:48:43Z")

</div>

I think the best thing you can do is to try to isolate it in a microsolution and if reproduceable then post to support at:

[http://crm.servoy.com/servoy-webclient/ … oy\_support](http://crm.servoy.com/servoy-webclient/solutions/solution/servoy_support)

> cbarbal:  
> Felicidades al evangelista.

MUCHAS GRACIAS… muy emocionado y orgulloso!.
