# search problem

**URL:** <https://forum.servoy.com/t/search-problem/3376>\
**Category:** Classic Servoy\
**Created:** [January 5, 2005, 4:51pm UTC](https://forum.servoy.com/t/search-problem/3376 "2005-01-05T16:51:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [January 5, 2005, 4:51pm UTC](https://forum.servoy.com/t/search-problem/3376/1 "2005-01-05T16:51:41Z")

</div>

Hello,

when searching in one of my forms (just this one, it seems), I get an error:

> Cannot format given Object as a Date

Strangely, whatever I search for - be it date or not - I get this error. I have a trace on that that shows that this query is sent:

```auto
select kontakte_emails.uid_email from kontakte_emails where kontakte_emails.empfaenger_to > ? order by kontakte_emails.uid_email

```

none of the fields envolved is a date field. The full error is this:

java.lang.IllegalArgumentException: Cannot format given Object as a Date  
at java.text.DateFormat.format(Unknown Source)  
at java.text.Format.format(Unknown Source)  
at javax.swing.text.InternationalFormatter.valueToString(Unknown Source)  
at com.servoy.j2db.dataui.DataField$d.valueToString(Unknown Source)  
at javax.swing.JFormattedTextField$AbstractFormatter.install(Unknown Source)  
at javax.swing.text.DefaultFormatter.install(Unknown Source)  
at javax.swing.text.InternationalFormatter.install(Unknown Source)  
at com.servoy.j2db.dataui.DataField$d.install(Unknown Source)  
at javax.swing.JFormattedTextField.setFormatter(Unknown Source)  
at com.servoy.j2db.dataui.DataField.setFormatter(Unknown Source)  
at javax.swing.JFormattedTextField.setValue(Unknown Source)  
at javax.swing.JFormattedTextField.setFormatterFactory(Unknown Source)  
at com.servoy.j2db.dataui.DataField.setValidationEnabled(Unknown Source)  
at com.servoy.j2db.dataprocessing.aw.setFindMode(Unknown Source)  
at com.servoy.j2db.dataprocessing.d.if(Unknown Source)  
at com.servoy.j2db.FormPanel.q(Unknown Source)  
at com.servoy.j2db.FormPanel.performFind(Unknown Source)  
at com.servoy.j2db.FormPanel$JSForm.js\_search(Unknown Source)  
at inv10.invoke()  
at org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:537)  
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:453)  
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)  
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1940)  
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)  
at com.servoy.j2db.scripting.e.call(Unknown Source)  
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)  
at com.servoy.j2db.develop.debugger.k.executeFunction(Unknown Source)  
at com.servoy.j2db.FormPanel.a(Unknown Source)  
at com.servoy.j2db.FormPanel.a(Unknown Source)  
at com.servoy.j2db.develop.debugger.k$h.actionPerformed(Unknown Source)  
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)  
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)  
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)  
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)  
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)  
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)  
at java.awt.Component.processMouseEvent(Unknown Source)  
at javax.swing.JComponent.processMouseEvent(Unknown Source)  
at java.awt.Component.processEvent(Unknown Source)  
at java.awt.Container.processEvent(Unknown Source)  
at java.awt.Component.dispatchEventImpl(Unknown Source)  
at java.awt.Container.dispatchEventImpl(Unknown Source)  
at java.awt.Component.dispatchEvent(Unknown Source)  
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)  
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)  
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)  
at java.awt.Container.dispatchEventImpl(Unknown Source)  
at java.awt.Window.dispatchEventImpl(Unknown Source)  
at java.awt.Component.dispatchEvent(Unknown Source)  
at java.awt.EventQueue.dispatchEvent(Unknown Source)  
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)  
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)  
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)  
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)  
at java.awt.EventDispatchThread.run(Unknown Source)

Servoy Developer  
Version R2 2.2b1-build 316  
Java version 1.5.0-b64 (Windows XP)  
MS SQL 2000

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [January 10, 2005, 2:25pm UTC](https://forum.servoy.com/t/search-problem/3376/2 "2005-01-10T14:25:02Z")

</div>

Just got that error again. I searched for an ID (integer) \> 0 and get this error. Is there any news on that?

Thanks  
Patrick

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [January 10, 2005, 2:34pm UTC](https://forum.servoy.com/t/search-problem/3376/3 "2005-01-10T14:34:48Z")

</div>

query doesn’t have anything do do with it.

You do have somehow value that you have in a Date Textfield that is not a date object. Please check for date fields on that form.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [January 10, 2005, 3:18pm UTC](https://forum.servoy.com/t/search-problem/3376/4 "2005-01-10T15:18:05Z")

</div>

hmm. I think I need some help with this. If I search manually there is no problem. If I use a method, it gets stuck. This is really strange; I have the impression, that the problem lies in a calculation of that table, but I see no problem there.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [January 10, 2005, 3:33pm UTC](https://forum.servoy.com/t/search-problem/3376/5 "2005-01-10T15:33:58Z")

</div>

show the complete method.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [January 21, 2005, 9:56am UTC](https://forum.servoy.com/t/search-problem/3376/6 "2005-01-21T09:56:35Z")

</div>

I am stgill getting this. This is a little weird. The error generated is this:

> sql select kontakte\_emails.uid\_email from kontakte\_emails where (kontakte\_emails.uid\_benutzer = ? and kontakte\_emails.uid\_benutzer\_emailordner = ? and kontakte\_emails.geloescht \< ? ) order by kontakte\_emails.uid\_emailquestiondata[0]= 4 ,type: java.lang.Integerquestiondata[1]= 6 ,type: java.lang.Integerquestiondata[2]= 1 ,type: java.lang.IntegerPingScanner woke up, queue [9fc15dfc-6b91-11d9-927e-ef239068a710(1106301059886)]PingScanner sleeping for 300000 milliseconds, queue [9fc15dfc-6b91-11d9-927e-ef239068a710(1106301059886)]spotlight: Closed connection, thread=AWT-EventQueue-0org.mozilla.javascript.JavaScriptException: java.lang.IllegalArgumentException: Cannot format given Object as a Dateorg.mozilla.javascript.JavaScriptException: java.lang.IllegalArgumentException: Cannot format given Object as a Date  
> at org.mozilla.javascript.JavaScriptException.wrapException(JavaScriptException.java:71)  
> at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:457)  
> at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)  
> at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1942)  
> at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)  
> at com.servoy.j2db.scripting.e.call(Unknown Source)  
> at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)  
> at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1942)  
> at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)  
> at com.servoy.j2db.scripting.e.call(Unknown Source)  
> at com.servoy.j2db.develop.debugger.k.a(Unknown Source)  
> at com.servoy.j2db.develop.debugger.k.executeFunction(Unknown Source)  
> at com.servoy.j2db.FormPanel.a(Unknown Source)  
> at com.servoy.j2db.FormPanel.a(Unknown Source)  
> at com.servoy.j2db.FormPanel$b.a(Unknown Source)  
> at com.servoy.j2db.dataui.DataComboBox.int(Unknown Source)  
> at com.servoy.j2db.dataui.DataComboBox.notifyLastNewValueWasChange(Unknown Source)  
> at com.servoy.j2db.dataprocessing.ar.commitEdit(Unknown Source)  
> at com.servoy.j2db.dataui.w.itemStateChanged(Unknown Source)  
> at com.servoy.j2db.dataui.DataComboBox.itemStateChanged(Unknown Source)  
> at javax.swing.JComboBox.fireItemStateChanged(Unknown Source)  
> at javax.swing.JComboBox.selectedItemChanged(Unknown Source)  
> at javax.swing.JComboBox.contentsChanged(Unknown Source)  
> at javax.swing.AbstractListModel.fireContentsChanged(Unknown Source)  
> at com.servoy.j2db.util.w.setSelectedItem(Unknown Source)  
> at javax.swing.JComboBox.setSelectedItem(Unknown Source)  
> at javax.swing.JComboBox.setSelectedIndex(Unknown Source)  
> at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(Unknown Source)  
> at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)  
> at java.awt.Component.processMouseEvent(Unknown Source)  
> at javax.swing.JComponent.processMouseEvent(Unknown Source)  
> at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(Unknown Source)  
> at java.awt.Component.processEvent(Unknown Source)  
> at java.awt.Container.processEvent(Unknown Source)  
> at java.awt.Component.dispatchEventImpl(Unknown Source)  
> at java.awt.Container.dispatchEventImpl(Unknown Source)  
> at java.awt.Component.dispatchEvent(Unknown Source)  
> at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)  
> at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)  
> at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)  
> at java.awt.Container.dispatchEventImpl(Unknown Source)  
> at java.awt.Window.dispatchEventImpl(Unknown Source)  
> at java.awt.Component.dispatchEvent(Unknown Source)  
> at java.awt.EventQueue.dispatchEvent(Unknown Source)  
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)  
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)  
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)  
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)  
> at java.awt.EventDispatchThread.run(Unknown Source)

This error is only thrown if I do a query like the one in the trace. To me the query looks good. I checked all kinds of date objects on the forms based on this table and I don’t see a problem there…

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [January 23, 2005, 8:56pm UTC](https://forum.servoy.com/t/search-problem/3376/7 "2005-01-23T20:56:05Z")

</div>

what are you doing with the result of that query?  
The query is fine. But somehow you are setting a value in a date field that can’t be formatted (so it is somehow not a date)

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [January 23, 2005, 9:11pm UTC](https://forum.servoy.com/t/search-problem/3376/8 "2005-01-23T21:11:23Z")

</div>

This is what generates the query and this is what gives me that error (I tthink the problem is somewhere else):

```auto
controller.find();
uid_benutzer = vUidBenutzer;
uid_benutzer_emailordner = vUidOrdner;
geloescht = '<1';
controller.search();

```

All columns and variables envolved are of type integer.

?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [January 23, 2005, 9:19pm UTC](https://forum.servoy.com/t/search-problem/3376/9 "2005-01-23T21:19:15Z")

</div>

it is not the query  
it is the result that that query has. Somehow it gives a value that should a date that is not a date. It looks like some column in the database is strange or something.

when ar you doing that query? in a method that is triggered with an onchange of a combo?  
Because that is what i see a onchange does trigger the method that has the error.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [January 23, 2005, 9:36pm UTC](https://forum.servoy.com/t/search-problem/3376/10 "2005-01-23T21:36:15Z")

</div>

yes, you are right. It is a “menu”, a global combobox that fires a search, basically. So if the menu is used, it will call a method that asks for the value of the global and executes the appropriate search.

I can also say that we get in trouble before the updateUI(), at least if I believe the debugger.
